Quote:
Originally posted by the_cranky_don
i am having a bit of difficulty getting scripts to run in slack 9.0.
.
.
.
when i try to execute th script i get errors like
> wlanup
sh: /usr/bin/wlanup: /bin/bash
: bad interpreter: No such file or directory
i have tried using '#! /bin/sh' at the start of the script with no luck
i issued 'which bash' and got
/bin/bash
any help or hints would be appreciated
thanks,
Don =)
|
If you notice on the wlanup output, you have the error output line broken into two segments.
first segment is:
sh: /usr/bin/wlanup: /bin/bash
second segment is:
: bad interpreter: No such file or directory
when it should not be. To test write a test script file with just the line:
#!/bin/basho
and see the output of it (when you do this, use a *NIX editor like vi, or emacs).
Comparing your output, with the basho output, you can see that yours breaks at
/bin/bash, which leads to the conclusion that the line where you define
#!/bin/bash has a
\r character appended at the end of it.
Another way to see this, is to run a trace of your script. To do that, you simple run your script like so:
sh -x ./wlanup
and then check the trace output.
How to fix?
delete the entire first line (i.e.
#!/bin/bash), and re-write it.
However, from the looks of it, whichever editor you used to write your script, may have appended more
\r characters on every line, which means, you may have to re-type the script using a *nix type editor.
Make sure you do not use any funky windows, type editor, otherwise the problem may happen again.
Hope this helped.
GL
//edit: added comment