Shell scripts running from /usr/local/bin - what did I forget to do?
I haven't done shell scripting in a long while, and so I may have overlooked something. I need a second (or third or fourth) pair of eves.
I have written a shell script: Code:
#!/bin/bash Code:
$ ls -aslt Code:
$ echo $path Code:
$ latexme filename Code:
$ latexme filename Code:
$ /usr/local/bin/latexme filename |
Ummm
What shell are you using? $path isn't meaningful in any shell I've come across, and $PATH should contain a colon-separated list of paths. Cheers, Tink |
I'm using tcsh:
Code:
$ chsh |
Hmmm ... dunno; try using a sensible shell for a test. ;}
|
No need to be snarky :P
It works under bash. Why it doesn't work in tcsh I don't know. |
Your script begins with '#!/bin/bash' but you are not using a BASH shell to launch the script. It seems that your shell (tcsh) passes the lower-case $path to the launched 'bash' instance, which within the bash realm yields an empty string. Could be that tcsh only maintains $path as an environment variable, and the $PATH output is rather a helpful hint from tcsh (clearly - I have no idea).
The fact that launching the script by full pathname works OK indicates that this is related to $path/$PATH in some way. By replacing the slashbang to '#!/bin/sh' you might get different results, because 'sh' is usually a link to the default shell executable - on many system it defaults to bash, but that's not carved in stone. linux |
I tried #!/bin/sh but that doesn't fit the issue; it still says that the command is not found.
On the $path vs. $PATH issue, I'm not exactly sure why it could be the source of the problem. Other executables run from the /usr/local/bin directory without the full path in the command line. |
And.. it's fixed.
Apparenly the thing I forgot to do is to rehash. After a logout and login unrelated to this script issue, it suddenly started to work. |
Edit: didn't see your fix before posting. That's ok. Normal behaviour in tcsh.
|
All times are GMT -5. The time now is 02:42 PM. |