bash / sh not working (not recognized?)
I'm trying to run a very simple script file to troubleshoot the issue and I'm getting the following error:
: bad interpreter: No such file or directory The contents of the file are: #!/bin/sh echo "hello" I've checked in /bin and I have both bash and a symb link to bash as sh. I've checked my path and I have the following: /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr/share/texmf/bin Any suggestions? How can I better troubleshoot this? Thanks. Hallamigo = = = = = = = = = = = = = = = = = = = Distro: Slackware 9.1 WM: Fluxbox-0.1.14 - - - - - - - - - - - - - - - - - - - - - - - Dell Inspiron 8200 Intel Pentium 4 Mobile CPU 1.60GHz 256MB RAM - 30 GB HD Nvidia GeForce2 Go (32 MB) Crystal WDM Audio = = = = = = = = = = = = = = = = = = = |
What did you name the file and did you make it executable?
And if the command is executable, is it in your current path? If not put a ./ in front of the command. |
Good questions, trickykid.
I've named the file 'test' and it is executable (755). Running it using ./test I get: : bad interpreter: No such file or directory Running it using '/bin/sh test' or '/bin/bash test' I get: : command not found hello BTW, earlier I was getting an extra colon and dot at the end of my path. I fixed this by putting: PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr/share/texmf/bin in my .bashrc file. |
Have you tried changing your script to be /bin/bash instead of /bin/sh ?
|
Just did, same results. I ran into this issue a long while back on one of my servers and then it just went away.
|
Got it! Thanks to this thread http://www.linuxquestions.org/questi...hreadid=136201 I was reminded of the issue I had before. I backed up these files to a Windows box and when I brought them back over Windows had changed the EOLs in the files making it so Linux couldn't read them - hense my error. Creating a fresh shell file or saving the file with a Linux editor fixed the issue.
Thanks all. |
All times are GMT -5. The time now is 08:41 PM. |