Results 1 to 3 of 3
Hi All,
U hiope you can be able to help me.
I am setting some environmental variable in my .bashrc , the sample code I was provided with is for ...
- 01-01-2011 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 22
[SOLVED] bash syntax to translate from csh scripts ..
Hi All,
U hiope you can be able to help me.
I am setting some environmental variable in my .bashrc , the sample code I was provided with is for CSH but I am using bash, and there are some syntax differences between them ... I got most of the script to work, but I am getting an error at this part :
the error is:Code:if ($RMSTREE == $RMANTREE) then set path=($path $RMANTREE/bin) else set path=($path $RMSTREE/bin $RMANTREE/bin) endif
The way to set environmental variables is different between chs and bash, so while csh uses setenv, in bash we use export.Code:bash: /home/renderuser/.bashrc: line 40: syntax error near unexpected token `(' bash: /home/renderuser/.bashrc: line 40: ` set path=($path $RMANTREE/bin)'
My guess is that the compound command in brackets has to be expressed differently to work in bash ... does anyone knows how should I translate that ???
Many thanks fro your help.
MahuroLast edited by MikeTbob; 01-03-2011 at 05:23 PM. Reason: Added Code Tags
- 01-01-2011 #2But I guess, you want to set the $PATH environment variable. In this case you have to captialize the variable name ($PATH instead of $path) and separate the values by colons ("foo:bar" instead of "foo bar").Code:
if [ $RMSTREE == $RMANTREE ]; then export path="$path $RMSTREE" else export path="$path $RMSTREE/bin $RMANTREE/bin" fi
So the code would be this:Code:if [ $RMSTREE == $RMANTREE ]; then export PATH="$PATH:$RMSTREE" else export PATH="$PATH:$RMSTREE/bin:$RMANTREE/bin" fiRefining Linux Advent calendar: “24 Outstanding ZSH Gems”
- 01-03-2011 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 22
[solved]
Hi Manko,
Many thanks that worked !!


