LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   new scripts won't run (https://www.linuxquestions.org/questions/linux-newbie-8/new-scripts-wont-run-331570/)

new2me 06-08-2005 11:16 AM

new scripts won't run
 
I'm on a RedHat Linux box (2.4.21-27.0.2.EL) and for some reason certain scripts just won't run (I get a 'command not found') even when I give an explicit path to the file.

The file is located in a directory with other scripts that run just fine. It's got the same permissions as the other scripts and is owned by the same user/group as the other scripts.

Oddly enough, if for example I type "tcsh -v x.sh", then the script does appear to run. I do, however, see "command not found" unexpectly mingled in the output.

What is going on???

Here's the the content of a script that I can't get to run normally, and the output I get when I invoke it as an arg to 'tcsh':
========== 'x.sh' script content ==========
#!/bin/tcsh
set release=
if ("${release}" != "")
set isRelease=1
echo yaba daba dooo
endif
echo testing 1 2 3
========== end conent ==========

========== start output ==========
[dfaison@jill admin]$ tcsh -v x.sh

set release=
if ( "${release}" != "" )
: Command not found.
set isRelease=1
echo yaba daba dooo
yaba daba dooo
endif
: Command not found.
echo testing 1 2 3
testing 1 2 3
[dfaison@jill admin]$ cat x.sh
#!/bin/tcsh
set release=
if ("${release}" != "")
set isRelease=1
echo yaba daba dooo
endif
echo testing 1 2 3
========== end output ==========

druuna 06-08-2005 11:23 AM

Hi,

Shouldn't this:

#!/bin/tcsh

be

#!/usr/bin/tcsh

Hope this helps.

new2me 06-08-2005 12:32 PM

thanks but that isn't it...
 
the system I'm on really does have 'tcsh' located in '/bin' directly off of the root.

druuna 06-08-2005 12:50 PM

Hi again,

Take a look at your if statement, you are missing the 'then' part.

if ("${release}" != "") then

I should have seen that the first time around............

Anyway, hope this helps.

new2me 06-09-2005 09:14 AM

found out the problem!!!
 
Thanks for the help but an associate of mine and I tracked down the problem.

Turns out the root of the problem was that I originally created the text file I was working with on a Windows machine.

Once I ran 'dos2unix' on it, mysterious 'command not found' problems went away.


All times are GMT -5. The time now is 06:30 AM.