LinuxQuestions.org
Help answer threads with 0 replies.
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 09-02-2004, 07:57 PM   #1
rtflynn
LQ Newbie
 
Registered: Sep 2004
Location: Madison, WI
Posts: 6

Rep: Reputation: 0
Thumbs down Shell scripts in tcsh not working on Suse 9.1


I'm trying to run a simple shell script in tcsh by creating a text file in emacs. It seems certain commands work and others don't. Note that the echo commands work, but the setenv and set commands do not. Each of these commands work when run individually from the shell prompt.

Here is the file, it's called "setup":

echo running
setenv CC g++
setenv LMALLOC
setenv LTHREAD -lpthread
echo finished

Here's what happens when I run it:
rtflynn> ./setup
running
./setup: line 2: setenv: command not found
./setup: line 3: setenv: command not found
./setup: line 4: setenv: command not found
finished
rtflynn>

I tried adding the line #! /bin/tcsh to the top of the file to ensure that the script was being run in the tcsh shell, but that didn't help. The "command not found" errors stopped showing up, but the setenv commands still did not work.

Any help on this issue would be greatly appreciated!
 
Old 09-02-2004, 08:24 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Are you positive that you're a) using tcsh
as your login-shell (cat /etc/passwd to check)
and b) when adding #!/bin/tcsh you're not supposed
to have a space after the ! and c) if you're running
the script rather than sourcing it you won't find
the environment variables your expecting even though
the script executed correctly


Cheers,
Tink
 
Old 09-02-2004, 08:45 PM   #3
rtflynn
LQ Newbie
 
Registered: Sep 2004
Location: Madison, WI
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks for your quick response!

a) I just confirmed that I was running tcsh by typing cat /etc/passwd
b) I got rid of the space and saw no change in the results
c) This may be my problem, but I'm not sure I understand what you mean by running vs. sourcing. Being a newbie, I don't know what the difference between these two ideas is. How do I source the script as opposed to run it?
 
Old 09-02-2004, 08:47 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
source <script-name>


Cheers,
Tink
 
Old 09-02-2004, 08:56 PM   #5
rtflynn
LQ Newbie
 
Registered: Sep 2004
Location: Madison, WI
Posts: 6

Original Poster
Rep: Reputation: 0
Got it! Thanks a lot!
 
  


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
changing text colors in tcsh shell leontini Linux - General 1 08-17-2004 03:53 AM
RH9, alias and tcsh shell jeguilloal Red Hat 1 11-26-2003 02:42 PM
tcsh shell problems ezrollers Linux - Software 1 06-20-2003 12:41 PM
Need sources of tcsh or some shell. alexzander Linux - Newbie 1 08-02-2002 01:34 AM
Need sources of tcsh or some shell. alexzander Programming 1 02-21-2002 11:21 PM


All times are GMT -5. The time now is 06:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration