LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-08-2005, 12:16 PM   #1
new2me
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Rep: Reputation: 0
Question 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 ==========
 
Old 06-08-2005, 12:23 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Shouldn't this:

#!/bin/tcsh

be

#!/usr/bin/tcsh

Hope this helps.
 
Old 06-08-2005, 01:32 PM   #3
new2me
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Original Poster
Rep: Reputation: 0
thanks but that isn't it...

the system I'm on really does have 'tcsh' located in '/bin' directly off of the root.
 
Old 06-08-2005, 01:50 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
Old 06-09-2005, 10:14 AM   #5
new2me
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run .sh scripts piggysmile Linux - Software 2 06-24-2004 07:18 AM
How do i get scripts to run? jihadcman Fedora 3 06-06-2004 11:15 AM
how do you run scripts toejam Linux - General 5 05-24-2004 09:24 AM
bash scripts won't run aamehl Linux - General 10 09-06-2003 03:25 PM
cannot run scripts unless su odious1 Linux - General 5 07-19-2003 01:25 AM


All times are GMT -5. The time now is 01:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration