in reply to Re^2: Need help to convert short c shell script to perl
in thread Need help to convert short c shell script to perl

Very unlikely to be the OP's input format. You're assuming sh syntax, whereas the OP's code is csh syntax, and hence his script would more be like

setenv InVAR0 42 setenv InVAR1 24

and that would be easy to parse, but what if it was

set foo=`foo` setenv bar "$foo":$PATH":"`cat /etc/PATH`

or even worse

set foo=`ttytype` eval $foo

Enjoy the puzzle

BTW I am a tcsh user myself, but I fully agree with TomC that csh/tcsh is not something to script in. Ever!


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: Need help to convert short c shell script to perl
by blue_cowdawg (Monsignor) on Sep 25, 2007 at 15:49 UTC
        You're assuming sh syntax, whereas the Op's code is csh syntax,

    Actually not assuming. I just defaulted to what I run into the most myself. Hardly ever touch CSH these days. I was more interested in demonstrating a concept than anything else.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
      I have tried to write a ksh to perl convertor RFC: UNIX shell to Perl converter, and csh has simpler syntax (for a parser, not a user).
      I gave up because I found most shell scripts are written very badly, and bad shell scripts converted into really bad perl.
            and bad shell scripts converted into really bad perl.

        Amen to that!


        Peter L. Berghold -- Unix Professional
        Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg