Re: Shell script or Perl?

2003-06-13 Thread Kirk Strauser
At 2003-06-13T04:11:47Z, Steve Lamb <[EMAIL PROTECTED]> writes: >> foreach $_ ($switch) >> { >> /^a$/ and do { print "a"; }; >> /^b$/ and do { print "b"; }; >> /^c$/ and do { print "c"; }; >> } > BTW, the above is still not that idiomatic. C'mon, any C

Re: Shell script or Perl?

2003-06-13 Thread Gregory Seidman
On Thu, Jun 12, 2003 at 05:57:05PM -0700, Steve Lamb wrote: } On Thu, 12 Jun 2003 23:48:47 +0300 } Aryan Ameri <[EMAIL PROTECTED]> wrote: } > If the intended users of the script are likely to use different Unix } > versions, then sh scripting is probably the safe bet. On the other } > hand, if yo

Re: Shell script or Perl?

2003-06-13 Thread Colin Watson
On Fri, Jun 13, 2003 at 03:36:54AM -0700, Steve Lamb wrote: > On Fri, 13 Jun 2003 09:37:36 +0100 > Colin Watson <[EMAIL PROTECTED]> wrote: > > I have to say that I can never remember whether Python's print includes > > a trailing newline, and I find it much more obvious when that's spelt > > out ex

Re: Shell script or Perl?

2003-06-13 Thread Steve Lamb
On Fri, 13 Jun 2003 09:37:36 +0100 Colin Watson <[EMAIL PROTECTED]> wrote: > I have to say that I can never remember whether Python's print includes > a trailing newline, and I find it much more obvious when that's spelt > out explicitly as it is in Perl ... > Language features can be idioms too.

Re: Shell script or Perl?

2003-06-13 Thread Colin Watson
On Thu, Jun 12, 2003 at 09:11:47PM -0700, Steve Lamb wrote: > for element in switch: > if hash.has_key(element): > print(hash(element)) > > 2 years later I'll know exactly what that code does. I have to say that I can never remember whether Python's print includes a trailing newli

Re: Shell script or Perl?

2003-06-13 Thread Colin Watson
On Thu, Jun 12, 2003 at 06:13:05PM -0700, Steve Lamb wrote: > On Thu, 12 Jun 2003 17:15:36 -0500 > Kirk Strauser <[EMAIL PROTECTED]> wrote: > > Not this again, indeed. I find a lot of shell scripts > > incomprehensible, but you seem to like them. That's OK - it's your > > preference. Please unde

Re: Shell script or Perl?

2003-06-13 Thread Colin Watson
On Fri, Jun 13, 2003 at 02:48:40AM +0300, Aryan Ameri wrote: > On Friday 13 June 2003 01:01, John Hasler wrote: > > Aryan Ameri writes: > > > BTW, now that we are here, I wonder about the portability of awk. > > > Is awk available on all major Unices? awk itself is very portable. Just be careful a

Re: Shell script or Perl?

2003-06-12 Thread Steve Lamb
On Thu, 12 Jun 2003 21:20:08 -0500 Kirk Strauser <[EMAIL PROTECTED]> wrote: > I'll admit that I'm not 100% consistent about that. I tend to use parens > when it helps to disambiguate the meaning of the code, along the lines of > saying "2 * 2 + 3" or explicitly stating "3 + (2 * 2)", even though t

Re: Shell script or Perl?

2003-06-12 Thread Richard Heycock
If I were you I would cut your loses and go with python. Whatever anyone says perl is virtually unmaintainable (yes I know you can write resonablyclean code but this is only through coding standards, which no one can agree on and consequently you have to force people to use them -- always a bad th

Re: Shell script or Perl?

2003-06-12 Thread Kirk Strauser
At 2003-06-13T01:13:05Z, Steve Lamb <[EMAIL PROTECTED]> writes: > Uh, no, read my post where I said that for any given situation I prefer > Perl over Shell script. OK, I hadn't seen that. > I also happen to have worked with Perl for far too long to fall into the > trap that it is easily maintai

Re: Shell script or Perl?

2003-06-12 Thread Steve Lamb
On Thu, 12 Jun 2003 17:15:36 -0500 Kirk Strauser <[EMAIL PROTECTED]> wrote: > At 2003-06-12T20:16:40Z, Steve Lamb <[EMAIL PROTECTED]> writes: > > Not this again. *sigh* The point is that it is far too simple in Perl to > > write s'ghetti code. > Not this again, indeed. I find a lot of shell s

Re: Shell script or Perl?

2003-06-12 Thread Steve Lamb
On Thu, 12 Jun 2003 23:48:47 +0300 Aryan Ameri <[EMAIL PROTECTED]> wrote: > If the intended users of the script are likely to use different Unix > versions, then sh scripting is probably the safe bet. On the other > hand, if you are counting on them, running your script on Windows or > tradition

Re: Shell script or Perl?

2003-06-12 Thread Aryan Ameri
On Friday 13 June 2003 01:01, John Hasler wrote: > Aryan Ameri writes: > > BTW, now that we are here, I wonder about the portability of awk. > > Is awk available on all major Unices? > > AFAIK POSIX requires it. I'm really not an expert in Unix, and it's standards, but IIRC Windows NT also passed

Re: Shell script or Perl?

2003-06-12 Thread Kirk Strauser
At 2003-06-12T20:16:40Z, Steve Lamb <[EMAIL PROTECTED]> writes: > Not this again. *sigh* The point is that it is far too simple in Perl to > write s'ghetti code. Not this again, indeed. I find a lot of shell scripts incomprehensible, but you seem to like them. That's OK - it's your preference.

Re: Shell script or Perl?

2003-06-12 Thread John Hasler
Aryan Ameri writes: > BTW, now that we are here, I wonder about the portability of awk. Is awk > available on all major Unices? AFAIK POSIX requires it. -- John Hasler [EMAIL PROTECTED] (John Hasler) Dancing Horse Hill Elmwood, WI -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject

Re: Shell script or Perl?

2003-06-12 Thread Aryan Ameri
On Thursday 12 June 2003 19:08, John Hasler wrote: > Matthew Weier O'Phinney writes: > > One aspect of [Perl] I particularly like is that it is also very > > portable: I don't have to worry about which shell is available on > > which system... > > On Unix and Linux conservatively-written POSIX sh s

Re: Shell script or Perl?

2003-06-12 Thread John Hasler
Sebastian writes: > BTW, is #!/bin/bash a valid choice for a Debian "official" shell script? Yes, but I would like to see it deprecated for maintainer scripts and forbidden for init.d scripts (the latter should be too simple to need bashisms). > After all, bash is an essential package AFAIK. Yes

Re: Shell script or Perl?

2003-06-12 Thread Steve Lamb
On Thu, 12 Jun 2003 13:22:16 -0500 Kirk Strauser <[EMAIL PROTECTED]> wrote: > I have to vehemently disagree. You can write spaghetti code in *any* > language, and you can write good code in Perl. Not this again. *sigh* The point is that it is far too simple in Perl to write s'ghetti code.

Re: Shell script or Perl?

2003-06-12 Thread Steve Lamb
On Thu, 12 Jun 2003 09:48:31 -0400 Chun Kit Edwin Lau <[EMAIL PROTECTED]> wrote: > In what situation does ppl normally use shell script and when > when will ppl use Perl? How about their performance like speed and also > the ease of programming? In years of working on unix systems from

Re: Shell script or Perl?

2003-06-12 Thread Jamin W. Collins
On Thu, Jun 12, 2003 at 07:19:27PM +0200, Sebastian Kapfer wrote: > On Thu, 12 Jun 2003 17:50:12 +0200, Gregory Seidman wrote: > > > Let me add one more detail: anyone who is about to write a shell script > > should read this page http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ > > Some of it

Re: Shell script or Perl?

2003-06-12 Thread Colin Watson
On Thu, Jun 12, 2003 at 07:19:27PM +0200, Sebastian Kapfer wrote: > On Thu, 12 Jun 2003 17:50:12 +0200, Gregory Seidman wrote: > > Let me add one more detail: anyone who is about to write a shell script > > should read this page http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ > > Some of it is

Re: Shell script or Perl?

2003-06-12 Thread Kirk Strauser
At 2003-06-12T14:46:39Z, Gregory Seidman <[EMAIL PROTECTED]> writes: > This makes maintaining any substantial chunk of perl code a > misery. I have to vehemently disagree. You can write spaghetti code in *any* language, and you can write good code in Perl. If you have any experience with typica

Re: Shell script or Perl?

2003-06-12 Thread Jamin W. Collins
On Thu, Jun 12, 2003 at 11:08:56AM -0500, John Hasler wrote: > Matthew Weier O'Phinney writes: > > One aspect of [Perl] I particularly like is that it is also very > > portable: I don't have to worry about which shell is available on which > > system... > > On Unix and Linux conservatively-written

Re: Shell script or Perl?

2003-06-12 Thread Sebastian Kapfer
On Thu, 12 Jun 2003 17:50:12 +0200, Gregory Seidman wrote: > Let me add one more detail: anyone who is about to write a shell script > should read this page http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ > Some of it is outdated, but the majority of it still applies. The short > version: scri

Re: Shell script or Perl?

2003-06-12 Thread John Hasler
Matthew Weier O'Phinney writes: > One aspect of [Perl] I particularly like is that it is also very > portable: I don't have to worry about which shell is available on which > system... On Unix and Linux conservatively-written POSIX sh scripts are more portable than Perl. -- John Hasler [EMAIL PRO

Re: Re: Shell script or Perl?

2003-06-12 Thread Benedict Verheyen
Jake Johnson <[EMAIL PROTECTED]> wrote: >Hi Edwin, >It all depends on the level of difficulty the problem is and how well you >know shell scripting vs. perl. I would recommend using perl script if you >need to massage files and need advan

Re: Shell script or Perl?

2003-06-12 Thread John Hasler
Edwin writes: > In what situation does ppl normally use shell script... When portability and robustness are important. > ...and when when will ppl use Perl? When the problem is more complex and speed is important. > How about their performance like speed... Perl is faster. > ...and also the e

Re: Shell script or Perl?

2003-06-12 Thread Gregory Seidman
On Thu, Jun 12, 2003 at 09:48:31AM -0400, Chun Kit Edwin Lau wrote: } In what situation does ppl normally use shell script and when } when will ppl use Perl? How about their performance like speed and also } the ease of programming? You probably didn't know it, but this is a good way to sta

Re: Shell script or Perl?

2003-06-12 Thread Matthew Weier O'Phinney
-- Chun Kit Edwin Lau <[EMAIL PROTECTED]> wrote (on Thursday, 12 June 2003, 09:48 AM -0400): > In what situation does ppl normally use shell script and when > when will ppl use Perl? How about their performance like speed and also > the ease of programming? Use what you're comfortable with,

Re: Shell script or Perl?

2003-06-12 Thread Jake Johnson
Hi Edwin, It all depends on the level of difficulty the problem is and how well you know shell scripting vs. perl. I would recommend using perl script if you need to massage files and need advanced features in your program, otherwise I would stick to a shell script that is small and fast. Good Luc

Shell script or Perl?

2003-06-12 Thread Chun Kit Edwin Lau
Hi everyone, In what situation does ppl normally use shell script and when when will ppl use Perl? How about their performance like speed and also the ease of programming? -- Edwin ERTW Lau -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Conta