http://qs321.pair.com?node_id=517723


in reply to Re: Difference between a perl script & shell script
in thread Difference between a perl script & shell script

Actualy, one of the first "I love perl" moments, for me came when I was moving programs between an SGI and a SunOs machine, back in the time when Perl was at version 4.19 and dinosaurs roamed the earth.

For some reason, the user shell on the SunOS (not in general, just on that particular machine) was mandated to be tcsh, and on the SGI it was bash. Or maybe it was the other way around.

Either way, porting shell scripts was a pain, porting C programs was a pain, but Perl scripts simply copied over. Nifty...

  • Comment on Re^2: Difference between a perl script & shell script

Replies are listed 'Best First'.
Re^3: Difference between a perl script & shell script
by Perl Mouse (Chaplain) on Dec 19, 2005 at 14:22 UTC
    For some reason, the user shell on the SunOS (not in general, just on that particular machine) was mandated to be tcsh, and on the SGI it was bash. Or maybe it was the other way around.
    I don't get this. Just because a users shell is tcsh doesn't mean that every shell program needs to be in tcsh - if the top line says #!/usr/bin/sh, it will be run in sh, regardless of the users shell.

    The only exception being shells that need to be "sourced" - but you can't write those in Perl anyway (unless your shell is Perl).

    Perl --((8:>*

      Unless the admin has done

      ln -s /usr/bin/sh /usr/bin/csh

      And/or for added entertainment value:

      $ stat -c %N /usr/bin/csh ,,/usr/bin/csh" -> ,,/bin/bash"

      Yes I've seen this on production systems :-/. I personally find it much easier to test and rely on Perls $] than the various wacky shell configurations out there. YMM undoubtedly V.


      Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan

        Crap like that is one of the reasons that they kept the sysadmins in a different, secure building in my last Unix-universe (actually, AIX) position. The sysadmins also did such lovable actions as neglecting to renew compiler licenses, which made it a trifle tough to get any work done. They would also change the directory structure without telling anybody.

        Yeah, but that's a severly broken system. You might as well have a system admin that does
        ln -s /usr/bin/python /usr/bin/perl
        and suddenly your shell scripts are more portable.
        Perl --((8:>*