LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 11:16 AM   #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, 11:23 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Shouldn't this:

#!/bin/tcsh

be

#!/usr/bin/tcsh

Hope this helps.
 
Old 06-08-2005, 12: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, 12:50 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 09: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



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 06:18 AM
How do i get scripts to run? jihadcman Fedora 3 06-06-2004 10:15 AM
how do you run scripts toejam Linux - General 5 05-24-2004 08:24 AM
bash scripts won't run aamehl Linux - General 10 09-06-2003 02:25 PM
cannot run scripts unless su odious1 Linux - General 5 07-19-2003 12:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:36 AM.

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
Open Source Consulting | Domain Registration