Go Back   openSUSE Forums > Archives > SLS Archives > ARCHIVES - SuSE Linux > ARCHIVES - General Questions
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - General Questions If your question doesn't fit in any other category below ask in here.

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 30-May-2008, 10:24
PattiMichelle
Guest
 
Posts: n/a
Default

I'm not sure where to post this, but I'm having trouble getting 10.2 and 10.3 tcsh to pick up environment variables - it doesn't seem to pick them up from a statement like:

> source somefile_with_setenv_statements_in_it

inside the file I'm sourcing are things like:
setenv PLATf Linux_AMD_G95
set vpath = /home/patti/V/Ver_6.0.2

But when I try to compile it reports:
vpath: Undefined variable

I'm wondering if it would help to set tcsh as the default shell for the whole system (rather than just me). I'm trying to compile some software that uses the tcsh syntax, and I think sometimes 10.2 uses the bash shell without asking. Where is the system-wide default shell set? Also, how can I check that tcsh is actually picking up the setenv's? (some command-line query?) Since I've never worked with tcsh before, I think there's something simple I might be doing wrong or else that SuSE's tcsh is not "standard."

I've been tinkering and trying to find that something simple I'm not doing for a long time and hoping someone can help.

PattiM
  #2 (permalink)  
Old 30-May-2008, 11:01
hcvv
Guest
 
Posts: n/a
Default

I am not a tcsh user (even not a csh one), but from other shells experience I may throw in some suggestions.

Shell variables are not normaly put into the environment of the process and thus not automaticaly inherited by sub-processes. In other shells you have to export them (perhaps tcsh does different):
Code:
export VAR='par'
or
Code:
VAR='par'
export VAR
Some shells behave different when you later change the value of VAR. Sometimes an export is needed again. I think the man pages will ducument this behavior.

Evry script should start with the shebang (it also has other names) so there can be no uncertainty about which interpreter to use:
Code:
#!/bin/bash
or
Code:
#!/usr/bin/tcsh
Any dependency on an assumed default is wrong.
  #3 (permalink)  
Old 30-May-2008, 16:02
KJ44
Guest
 
Posts: n/a
Default

You can choose to use bash or tcsh or <some shell> in your terminals/consoles from the User setup in YaST.
The advice about the shebang when writing scripts is most important.
I use tcsh as my command line shell, but I write my scripts in bash.
In your shoes I'd use bash for everything - I use tcsh out of habits going back years.
In tcsh, "setenv" will export automagically if you source the script.
  #4 (permalink)  
Old 31-May-2008, 11:19
PattiMichelle
Guest
 
Posts: n/a
Default

Thanks for the replies - it suddenly started working. For some reason I had to reboot in order to get it to pick up environment variables. Maybe that's just an x86_64 thing, but invoking tcsh (in bash) didn't even read the .tcshrc file, now it is. So something was wrong... but now OK.
THANKS!!!!!!!!
Patti
  #5 (permalink)  
Old 31-May-2008, 14:31
eberhard
Guest
 
Posts: n/a
Default

changed
 

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2