Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Sep 2007 22:12:15 +0200
From:      Mel <fbsd.questions@rachie.is-a-geek.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: csh if..then delhema.
Message-ID:  <200709092212.15837.fbsd.questions@rachie.is-a-geek.net>
In-Reply-To: <20070909193540.GA3569@thought.org>
References:  <000801c7f274$6fae71e0$6501a8c0@GRANT> <20070909131721.GA1859@kobe.laptop> <20070909193540.GA3569@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 09 September 2007 21:35:40 Gary Kline wrote:
> On Sun, Sep 09, 2007 at 04:17:21PM +0300, Giorgos Keramidas wrote:
> > On 2007-09-09 08:57, Grant Peel <gpeel@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).
>
> 	Do any of you gents know if there is a converter that turns
> 	Bo[u]rne (:-)) shell into perl?  Years ago there was
> 	commericalware (i Think) that took /bin/sh to C.  Maybe Ii'm
> 	mis-remembering.  I've googled aroud and find zip, so maybe I
> 	was in some kind of coma-zone.
>
> 	At any rate, for simple unix scripts, /bin/sh (aka "a-shell", ash)
> 	or ksh or zsh is the way to go.  Simple == a few lines.
> 	For anything grittier, perl wins any time.

Perl looses when /usr isn't mounted. That's the primary argument against using 
anything other then /bin/sh (including bash). All the rest is preference.

-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709092212.15837.fbsd.questions>