why Unix?

Alexander Pánek alexander.panek at brainsware.org
Thu Apr 9 00:17:11 PDT 2009


Daniel Keep wrote:
> Christopher Wright wrote:
>> With Powershell, you need to be familiar with the tools for dealing with
>> System.Data.DataTable or whatever. Maybe it would only take ten minutes.
>> The most time it could save in that regard is an hour.
> 
> The syntax for these commands is so simple, you don't even really need
> to learn them.
> 
> It's stuff like "get-columns" and "sort-list".  I don't think I ever ran
> across a powershell command where I couldn't accurately guess it's
> purpose.  Most of the time, I even got the syntax first try without
> needing to check the help.
> 
> What's more, it's the SAME set of tools for EVERY kind of object.  If it
> helps, imagine if in UNIX you could treat any file as a folder of files
> containing the parsed contents (each of which may, themselves, be
> folders of files.)
> 
> You wouldn't need sed or awk for parsing any more because the
> environment has already done it for you.
> 
>> The cost of learning is not a significant factor here. You might have
>> plenty of other good arguments (and I offered some), but this isn't one
>> of them.
> 
> It took me a year or more to become fluent and comfortable with
> scripting in UNIX.  I don't think you CAN learn things like sed or grep
> straight away because you've got to learn the regex language first (and
> they're always bloody different in every different environment.)  You
> then have to learn how the program works, and which options are actually
> useful.  And then you need to practice with it.
> 
> When I first started using sed, I had to constantly check the man page
> because I forgot which options I wanted to use.  Same thing with grep (I
> only recently started remembering when I needed the -v switch, for
> example, and I've been using it for years!)
> 
> Powershell's learning curve is practically non-existent.  There are no
> domain-specific languages; just standard commands with regular, obvious
> names that all do one thing really well.
> 
> Within about an hour of first seeing powershell in action, I felt
> comfortable writing simple scripts to munge data.  An hour versus a
> year+ with UNIX; that's not something you can simply ignore.
> 
> If you're happy with UNIX, then that's fine.  But discounting the things
> powershell does well is just doing yourself a disservice.
> 
> What really saddens me is that, assuming powershell is better, UNIX will
> never match it; at least not for a very long time.  UNIX has so much
> history in its CLI, whereas Windows doesn't.  Microsoft can afford to
> "reboot" the Windows CLI and start from scratch; UNIX can't.
> 
> Then again, Microsoft could just flub the whole thing anyway.  :P
> 
>   -- Daniel

The thing is, I don't *want* my _shell_ to be able to parse anything. 
It's a shell, not a framework with everything and two kitchensinks built 
in to parse every imaginable file format on my computer. That's the 
whole point of the UNIX philosophy: small, encapsulated tools that do 
one or a few tasks very well.

So instead of just writing a program that reads text from STDIN or a 
file, parses the input and spits something about the file out in another 
form of text, I'd have to write, maintain and distribute that exact 
program AND an additional .NET "cmdlet". Not only that it's another part 
of my software I will have to maintain, it only works on one OS with one 
shell. On any UNIX, I can just use it. Compile it, use it. Pretty 
straight forward.

When I write a sh script, it will work on a multitude of OSes, no matter 
how old or young it might be, no matter what purpose it serves. Granted, 
the syntax is a big downside, but you will usually fall back to the 
scripting language of your (or your project's) choice anyways at some 
point. E.g. the deploy process of Rails applications is not written 
using sh. They're simply written in Ruby (as rake/capistrano tasks).


I'm not saying the powershell is a bad thing. The bad thing is that it 
doesn't work everywhere. When the powershell was released I couldn't use 
it because the Windows I was running was too old. So Microsoft has this 
awesome shell that only works on their newest OS. What if I wanted to 
automate something on my grandmother's PC with Windows 98? Or for less 
suckage, lets say Windows 2000? I can automate processes on *any* UNIX, 
as long as it provides a shell and every UNIX I could possibly think of 
does that. So the same automation that I made on my opensolaris server 
works on my aunt's completely different computer with Linux on it.

.02
Alex



More information about the Digitalmars-d mailing list