csh if..then delhema.

Giorgos Keramidas keramida at ceid.upatras.gr
Sun Sep 9 06:18:01 PDT 2007


On 2007-09-09 08:57, Grant Peel <gpeel at thenetnow.com> wrote:
> Thanks for the input gentlemen,
> Interesting to that the question was posted by G(rant) and then
> answered by G(ary), G(arrett) and G(iorgos)! (what are the odds!).

Haha :)

> Anywho, I am busily converting the script to perl as per the
> suggestions. I use tcsh rarely, had I of known the quirks I woul shave
> done it in perl from the beguining.
>
> As for Garrett's case method, it didnt work. Created a "case: Too many
> arguments." error. Perhaps because it itself is nested in a 'foreach'
> statement.

`foreach' is a csh construct.  If you copied the case/esac code posted
by Garrett, then it wouldn't work.  The syntax used by Garrett was for
the Bourne shell (hence the /bin/sh reference above case).

If you are going to convert everything to /bin/sh, you may as well
convert it to Perl unless there is some very good reason to use only
the pretty minimal data-structures supported by the Bourne shell
(i.e. because you want to run the script in environments where Perl
may be too much to require).

- Giorgos



More information about the freebsd-questions mailing list