2

So I was just taking a look at the example posted on the dlang website here: http://dlang.org/rdmd.html and was looking to do something like the second version where you define #!/usr/bin/env rdmd as the first line of your file. I copied and pasted the exact copy of what they have there just to try it out and everytime I try to do ./myprog.d I get: : No such file or directory

What am I missing here? If I run rdmd ./myprog.d it works just fine so I know rdmd is in the proper path

csteifel
  • 2,854
  • 6
  • 35
  • 61
  • did you also make the file executable? `chmod +x myprog.d`, though if you didn't I think the error would b e permission denied rather than no such file... another thing to check is if the `/usr/bin/env` command actually runs on your system. You might be better off just putting the direct path to your rdmd in there like `#!/home/me/dmd2/linux/bin32/rdmd` is how I'd do it on my computer. – Adam D. Ruppe Jan 24 '15 at 21:21
  • It is executable (774) and `/usr/bin/env` is on my system and I can do `/usr/bin/env rdmd myproog.d` and it works fine. Putting the absolute path does not work as bash complains that its a bad interpreter. – csteifel Jan 24 '15 at 21:26
  • 1
    hmm it might be trying to run the 32 bit version on a 64 bit system or vice versa... in fact I'm almost certain that's the problem, that gives "no such file or directory" because the /lib/ld-Linux for the bittiness isn't there. So the fix would be maybe just deleting the one so it forces the use of the other from the path – Adam D. Ruppe Jan 24 '15 at 21:30
  • "smells" like rdmd is not in your path. – DejanLekic Jan 24 '15 at 22:22
  • `echo $PATH`: `/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/me/.local/bin:/home/me/bin` `which rdmd`: `/usr/bin/rdmd` – csteifel Jan 24 '15 at 22:23

2 Answers2

7

This is nice(hard) one. I like this kind of issues. You have wrong newline delimeter, probally \r\n instead of \n

Kozzi11
  • 2,413
  • 12
  • 17
  • Thanks a bunch, turns out I forgot to mark unix style endings cause I was editing this on my windows machine over a network share. – csteifel Jan 25 '15 at 18:06
  • This was one of reasons Why I almost doesn't finish my university (bad newlines in makefile :)). – Kozzi11 Jan 25 '15 at 18:47
1

Some Unixen have env in /bin, others in /usr/bin. Find where yours is by executing which env. Then use that one.

Andrei Alexandrescu
  • 3,214
  • 19
  • 17