Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Myth busted: Shell isn't always faster than Perl

by Perl Mouse (Chaplain)
on Jan 02, 2006 at 17:28 UTC ( [id://520417]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Myth busted: Shell isn't always faster than Perl
in thread Myth busted: Shell isn't always faster than Perl

Right. So, you shy away from shells because it's not portable, and then you suggest using a USB keyring drive - as if file systems are all that portable. Not to mention that in a lot of places, computers are protected, and you can't stick in CDs, floppy disks or USB devices easily.
Personally, I would find it COST efficient to put all my Perl utilities on a USB-keyring-drive, rather than spend the time to learn "arcane" shell syntax.
Well, I could understand a Java or a Python coder complaining another language has an "arcane" syntax. But a Perl programmer complaining shell has "arcane" syntax, I can't take seriously. And for cost, let's see, you move from one box to the other. First, you have to umount the USB device from the one box, crawl under the table to remove the device, crawl under another table to put the stick in the different box, become super user on the new box, edit /etc/vfstab or /etc/sudoers so a regular user can mount a USB device, log off as root, mount the USB device, become root again, fix the syntax error in the file you just edited, log off as root, mount the USB device, and then you're ready to remove the files. No thanks, I just type in the handful characters on the command line - it's faster, and hence, more cost efficient.
Everytime I look at the way bash shell is done, it blows my mind as being the most confusing syntax that I've ever seen.
Well, we're talking about
find . -type f -print0 | xargs -0 rm
and we have a Perl programmer complaining the syntax is hard to understand.
Perl, C, PhP, Python, etc. all have 'compatible' syntax,
I think many Python programmers would be deeply insulted by that statement.
Bash shell is definitely odd.
Really? The Bourne shell (which is what you ought to use for scripts) has loops, functions, and conditions, just like C, Python and Perl have. It's interpolation options are vastly superiour to Perl. Perhaps the oddest things shells have are redirection, (>, >>, <, |), but Perl has them as well in its open statement. And Perl6 will have ==> and <== acting as pipes.
I find it admirable that some hackers use different languages according to what is easier to do, but how many syntax errors do they make, when they are juggling shells?
Why would you juggle shells? The Bourne shell (or a compatible shell) is available on every Unix or Unix-like OS - it's a POSIX requirement. Any sane shell programmer will write his shell scripts in the Bourne shell. No 'juggling' needed. I generally have less problems in the shell going from one OS to another than in Perl - where one box will have a thread enabled 5.8.7 perl with 64 bit integers, the other will have 5.6.0 with no threads and only 32 bit integers. Furthermore, the line being discussed will work on any mainstream shell (sh, bash, csh, tcsh, ksh, ash, zsh, ...)
Perl --((8:>*

Replies are listed 'Best First'.
Re^6: Myth busted: Shell isn't always faster than Perl
by chromatic (Archbishop) on Jan 02, 2006 at 18:53 UTC
    But a Perl programmer complaining shell has "arcane" syntax, I can't take seriously.

    I've edited cross-platform Makefiles. Shell has multiple incompatible ugly arcane syntaxes.

Re^6: Myth busted: Shell isn't always faster than Perl
by zentara (Archbishop) on Jan 03, 2006 at 12:30 UTC
    I was going to let this thread die, but this is just too much fun. :-)

    then you suggest using a USB keyring drive - as if file systems are all that portable

    Well you could have 2, 1 vfat and one ext2; that would get you onto most systems. You could also carry around a bootable cd like knoppix, so you can boot systems anyway you want.

    crawl under the table to remove the device, crawl under another table to put the stick in the different box,

    Hackers need exercise.

    we're talking about find . -type f -print0 | xargs -0 rm

    So I'm supposed to memorize that to save me .1 seconds? The shell programmers who threw that out as a solution didn't even remember the nulls right, and I'm supposed to? Let's see, was that -print0 | xargs -0 OR -print 0 | -xargs0 ? Did I need that funny {} or not, damn, I could have finished already if I just wrote it in Perl.!

    Why would you juggle shells?

    Why do you climb under tables?

    I'm just having fun with you, sorry. I, like probably most computer hackers, deal with 1 or 2 computers until their control. A desktop and a laptop. If you have a job, or the need to be moving from one machine to another, without root priviledges, then it pays to have memorized those bash shell 1-liners. But for most of us, we can use our ~/bin directories to store our perl scripts.


    I'm not really a human, but I play one on earth. flash japh

      You could also carry around a bootable cd like knoppix, so you can boot systems anyway you want.

      And you complain that shell isn’t portable?

      Makeshifts last the longest.

        You win. :-)

        I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://520417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-26 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found