why Unix?

grauzone none at example.net
Tue Apr 7 12:03:54 PDT 2009


Steven Schveighoffer wrote:
> On Tue, 07 Apr 2009 14:35:04 -0400, grauzone <none at example.net> wrote:
> 
>>> But shell scripting in itself is so powerful for this kind of stuff.  
>>> I've written lots of little scripts to do fantastic things that on 
>>> Windows would be so painful (without cygwin of course).  Like 
>>> renaming all files of a certain type to something else, or copying 
>>> select files to another directory.
>>
>> Now wouldn't that be much more powerful to use an actual programming 
>> language for this, instead of bash? I claim with something like 
>> python, bash doesn't really have any right to exist anymore.
> 
> I can log into ANY Linux, Solaris, BSD, OSX, etc system and have a 
> reasonable /bin/sh that allows at least bourne shell functionality.  The 
> same can't be said for almost any other scripting language you can throw 
> at me.

Sure, /bin/sh is the least common denominator. But is there a UNIX that 
can't run python?

> Of course, aside from that, I hate python syntax...  And can python be 
> used as a user shell?

Don't tell me you hate it more than the clusterfuck that is sh syntax? 
Reading or writing sh scripts always feels like screwing in bolts into 
my head.

And regarding using it as an user shell: there's an interactive command 
line interpreter.

> How would you do the same thing in python?  Would it be any clearer or 
> shorter?  Probably not.

Not in all cases. But in general, I'd expect it to be clearer. Python is 
just more similar to normal programming than sh, which is why I'd prefer it.

sh scripts aren't very reliable either. I remember that script that 
invoked another program. That other program produced some warning, and 
the script interpreted it as normal output. And escaping. I don't think 
there are many scripts that still work correctly if they encounter 
"strange" filenames, like filenames with spaces, special characters, or 
even line breaks. Yes, \n is a valid character in UNIX filenames.

> I'm sure some would argue that there is no point for python if you can 
> run perl...

Perl doesn't have any right to exist either. It has the same brainfuck 
quirks like sh. For example, defining magical global variables and such. 
And clusterfuck syntax. It even has a reputation as read-only language.

For that matter, any language better than sh or Perl would be better for 
a shell.

> -Steve



More information about the Digitalmars-d mailing list