[Tfug] Re: csh/tcsh users
t takahashi
gambarimasu at gmail.com
Thu Nov 3 00:03:27 MST 2005
try using (...) or {...} to force it.
long term solution: switch to bash or zsh. they suck in different ways,
but both suck less than csh. imho.
to get you started, i recommend this syntax:
if [ ... ]
then
if [ ... ]
then
...
fi
...
fi
to look up how to use [] look up test in the man pages or do help test in bash.
On 11/2/05, Jim Secan <jim at nwra.com> wrote:
> If there are any csh/tcsh gurus out there I'm having an ongoing battle with
> nested if-then-else constructs. These things have worked for years on
> Solaris, and I'm getting tired of hacking work-arounds on Linux (FC3).
>
> An example:
>
> if($BUILD_G == NO)then
> echo 'STATUS: G matrix already built'
> if(!(-e $gelFile))then
> rm $gelFile
> ln -s $GMdir/$gelFile $gelFile
> endif
> if(!(-e $refFile))then
> rm $refFile
> ln -s $GMdir/$refFile $refFile
> endif
> echo Linked to gel and ref files in $GMdir
> endif
>
> If BUILD_G is NO, it works fine. Otherwise, rather than not executing
> everything between the initial "if" and the final "endif" the shell jumps
> to the first "endif" it encounters and starts from there. In this case, it
> starts in at the
> "if(!(-e $refFile))then" line and keeps going. Sorry, but this is just
> wrong.
>
> So, has the shell got a bug (which it's had for several years now) or
> what's going on?
>
> Jim
>
> *---------------------*-------------------------------*
> | Jim Secan | Northwest Research Assoc, Inc |
> | (jim at nwra.com) | 2455 E. Speedway, Suite 204 |
> | (520) 319-7773 | Tucson, Arizona 85719 |
> | Space Weather Info: http://www.nwra-az.com/ |
> *---------------------*-------------------------------*
> _______________________________________________
> tfug mailing list
> tfug at tfug.org
> http://www.tfug.org/mailman/listinfo/tfug
>
--
Webmaster: do you believe that people will switch browsers to view
your page instead of going to your competitor?
More information about the tfug
mailing list