Slashdot Mirror


Unix Shell Programming, Third Edition

honestpuck writes "Back when dinosaurs roamed the earth and NCR made Unix computers I first started to program for a living. Back then when someone said 'script' they meant a shell script, generally for a Bourne shell." Even if the definition of "scripting" has grown somewhat, honestpuck argues, the old meaning still has merit and use. Read on for his review of the latest edition of Unix Shell Programming. Unix Shell Programming, Third Edition author Stephen G. Kochan and Patrick Wood pages 406 publisher SAMS rating 8 - Well written, good topic coverage, some small flaws reviewer Tony Williams ISBN 0672324903 summary Good introduction to shell programming and using the shell

Now that we have languages such as Perl and Python, much of shell scripting has been forgotten. The need still arises for the times and places where running Perl would be just that little bit too much overhead; cron jobs, process start and stop scripts, even machine start and stop scripts. For these we could best go back to the old ways. Combining the power of the common Unix tools, pipes and scripts in a fairly obscure and slightly arcane syntax is not easy to pick up, though the language's simplicity does, in some ways, make it easier than more complex ones such as Perl. This book does a good job at introducing shell programming and I found it an excellent book when I needed a refresher.

I don't want to sell this volume short: you won't just learn about shell programming. The first ninety or so pages provide an excellent guide to getting the best out of the shell, and the last chapter is devoted to the features specific to an interactive shell such as command-line editing and using the history.

The authors have chosen to use the POSIX standard Bourne shell ('bash', available on many *nix systems, is a superset of the POSIX standard). That seems the right decision, given that it is so universally available and usually the default shell.

The book is well structured, starting out with a brief look at *nix operating systems before introducing the shell followed by some basic tools; cut, paste, sed, tr, grep, sort and uniq. One minor quibble, the book explains how to redirect STDOUT to a file and STDERR to a file, but not how to redirect both to the same file. That aside, these few chapters provide a good introduction to the shell.

The text goes on to systematically explore shell programming starting with variables and arithmetic. The chapters are kept short, in a good order and have a number of exercises at the end of each. The structure of the book and the order each new concept is introduced is well thought out; at each stage small examples are given that only use material already introduced and are complete in performing a task. In early chapters they are fairly trivial but by the end there is a fairly complete rolodex program written in shell script that would be a good model for anything you wished to do.

There is also a good summary of the shell syntax and common commands in Appendix A and good 'Further Information' in Appendix B. Kudos must go to the authors for a list of books for further reading that is not ashamed of mentioning other publishers, indeed they say "One of the best sources of books on Unix-related topics is O'Reilly and Associates" and list volumes from them before mentioning their own publishers.

There are some small typographic errors in the text but I did not find any in the script examples I tried. I found it to be well written and readable throughout, perhaps an advantage of a third edition in a slow moving technology.

You can visit the Sams web page devoted to the book which has the Table of Contents and the third chapter available for download. It has no errata or source code, I looked to see if the authors maintained a site for the book but could not find one.

I would recommend everyone read this book once or twice, it provides a comprehensive, well written tutorial on one of the most basic (and often overlooked) tools at your disposal. Even Windows users could install Cygwin and gain the benefit of a good POSIX compliant shell and this book. It also has the advantage that once purchased it will be useful for many, many years to come - the language has not changed noticeably in twenty five years and should not change in another twenty five.

You can purchase Unix Shell Programming, Third Edition from bn.com. Slashdot welcomes readers' book reviews -- to submit a review for consideration, read the book review guidelines, then visit the submission page.

292 comments

  1. I'll start scripting when... by Anonymous Coward · · Score: 1, Funny

    JPSoft makes 4UNIX.

    1. Re:I'll start scripting when... by Guy+Innagorillasuit · · Score: 0

      Welcome to Windows, where even the CLI uses a GUI. Then again many *nix GUI applications are using the CLI underneath...

    2. Re:I'll start scripting when... by Anonymous Coward · · Score: 0

      JPSoft makes 4UNIX.

      You've obviously never used Unix... Even scripting using the standard bourne shell and utils is massively more powerful than 4DOS/4NT. If you really want everything, use zsh.

    3. Re:I'll start scripting when... by Anonymous Coward · · Score: 0

      Nah, 4NT doesn't use a GUI.

    4. Re:I'll start scripting when... by Guy+Innagorillasuit · · Score: 0

      It looks like a shell for the shell, not really a GUI but still a pretty sad comment on the CLI.

    5. Re:I'll start scripting when... by Anonymous Coward · · Score: 0

      It's essentially a drop in replacement. I don't need to run cmd.exe before I run 4nt.exe. I used 4OS2 back in OS/2, and 4DOS back in DOS. Great stuff.

    6. Re:I'll start scripting when... by dollar70 · · Score: 1
      If you really want everything, use zsh.

      zsh?
      zshell?
      z? Z?
      I got it! Zombo!

      This is ZomboShell! You can do anything at ZomboShell. The infinite is possible at ZomboShell! Yes, This - is - ZomboShell!

      In case you don't get it...

  2. Shell scripting is a Lost Art by Saeed+al-Sahaf · · Score: 3, Insightful

    Shell scripting is a Lost Art. You know the True Gurus in the IT department by how comfortable they are with shell scripting. And of course, in the world of Microsoft, now one knows what you're talking about when you talk about scripting, they assume VBScript (the language of virii).

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:Shell scripting is a Lost Art by MoonFog · · Score: 3, Interesting

      I wouldn't call it a lost art, but with all the advancements in GUI, it certainly doesn't get used as much as it should.
      I find it to be a very nice tool to do simple jobs, without having to write a program to do it.

      If I'm not mistaken Longhorn (next Windows) will even have a shell like interface (something other than the command prompt), so perhaps shell scripting will have some sort of a ressurection in the following years.

    2. Re:Shell scripting is a Lost Art by El+Cubano · · Score: 0, Flamebait

      If I'm not mistaken Longhorn (next Windows) will even have a shell like interface (something other than the command prompt), so perhaps shell scripting will have some sort of a ressurection in the following years.

      Of course, this will prompt MS to claim to have "invented" or "innovated" shell scripting.

    3. Re:Shell scripting is a Lost Art by kfg · · Score: 2, Interesting

      When I really need a program I'll turn to Python or C, but 99% of the time when I just need to get something done grep, find and a knowledge of regular expressions does the trick.

      Throwing in a bit of sed handles most of the rest.

      The power inherent in these simple tools is really quite amazing and knowing how to use them means I've never had to upgrade from my 486 laptop.

      The only real downside is a need for at least a practical understanding of formal logic and set theory and some people are agin that.

      Takes all kinds I guess.

      KFG

    4. Re:Shell scripting is a Lost Art by Clover_Kicker · · Score: 1

      There's a lot to hate about VBScript, but has good points. VBScript/WSH has a lot of hooks to the Win32 guts, and comes pre-installed on all your machines.

      BTW, you can't honestly tell me you ENJOY programming in straight bash?!?!?

    5. Re:Shell scripting is a Lost Art by pclminion · · Score: 2, Interesting
      when you talk about scripting, they assume VBScript (the language of virii).

      Hold on a damn minute... It's quite possible to write a virus in Bourne shell script, also. A virus that not only infects other shell scripts, but binaries as well. I know this because I did it as a project for a course in college.

      Just goes to show you can do damn near anything in shell script.

      No, I won't explain how it's done -- if you can't figure it out on your own, you're too stupid to handle the knowledge responsibly :-)

    6. Re:Shell scripting is a Lost Art by Saeed+al-Sahaf · · Score: 1
      BTW, you can't honestly tell me you ENJOY programming in straight bash?!?!?

      Yes, yes, I know, but I see a psychologist about it, and I'm getting better...

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    7. Re:Shell scripting is a Lost Art by ultrabot · · Score: 1

      When I really need a program I'll turn to Python or C, but 99% of the time when I just need to get something done grep, find and a knowledge of regular expressions does the trick.

      Those can usually be done on a single pipeline. Some people insist on using multiline shell scripts to do the trick.

      --
      Save your wrists today - switch to Dvorak
    8. Re:Shell scripting is a Lost Art by norsk_hedensk · · Score: 1

      thats BS. shell scripting is alive and well, and as long as unix is used on the server, then shell scripting will be aswell.

    9. Re:Shell scripting is a Lost Art by rmdyer · · Score: 4, Informative

      In my mind shell scripting sits at the highest level of process control. You are basically working above all other methods to control your machine with a thin and light interface. In shell scripts, you typically start and stop processes, check for active processes, log information about processes, control the flow of or filter process data. You also work directly with files on the file system by checking for them, moving them, renaming them, deleting them, appending to them, etc. In short, shell scripting is exactly what it says it is...scripting what you would otherwise do by hand at the shell prompt.

      Shell scripting usually trumps all other programatic languages in that the engine is so small. That allows it to start up and shutdown really quick, not like the bloated Perls, Pythons, Java's, VBs, etc. A typical shell script engine might use about a Meg or less. Shell scripting is not programming in the strict sense of the word. You are not working in a well structured and cohesive language to be used for a variety of application development. No, shell scripting was made primarily for process and file system management. Making shell scripting work much beyond those means is an art, and not something that should ordinarily be done because other better languages should be used to fulfill broader purposes.

      In our Windows environment we use CMD.EXE, or the command shell engine for just about all of our network control scripting. It comes with Windows, and is the only standardized default shell console. The command shell of NT/2k/XP is NOT your fathers BATCH language. Microsoft made some extensive professional changes to the command shell engine starting way back with Windows NT 3.51. The command shell is now very functional and has many Bourne shell syntax features.

      Microsoft hasn't promoted the use of the command shell until very recently. This is because early on, they wanted to push system programmers and admins into using their GUI tools and VB scripting languages so that you would have to buy other products. Microsoft really pushed people away from using command shell scripting for the purpose of their own gain. Recently, with the gowing popularity of Linux and Unix again, they are now pushing to get people to use the command shell. They've finally documented most of the many changes they've made to the shell over the years, those changes that were kept in secret to all but the most diehard shell users.

      The most popular changes come with the following commands...

      CALL, GOTO, EXIT, FOR, and SET.

      These commands have been expanded for the development of subroutines, string manipulation, math functions, tokenizing, file system recursion and enumeration. The command processor is fairly powerful in its own right because you don't have to exit very much for externals like FINDSTR, or SED/AWK type executables.

      Under NT/2k/XP if you are using the ".BAT" extension for your scripts, or the "COMMAND.COM" processor, then don't. These are now outdated. If you fire up command.com, the the 2k kernel must startup the 16 bit virtual dos machine (VDM). This is S-L-O-W, and the BATCH language is indeed very poor. You should now use the ".CMD" extension for your command shell scripting.

      See the following for more command shell (cmd.exe) documentation...

      Command Shell Docs

    10. Re:Shell scripting is a Lost Art by Anonymous Coward · · Score: 0

      Thanks for the link.

      As a fascinated n00b, I am awful at Unix shell scripting and complex cmd scripts.

      Just because I'm no good at it, doesn't mean I'm going to stop trying to learn (in the relative safety of my own home).

      I'm off to pick up that Unix book, too.

    11. Re:Shell scripting is a Lost Art by archen · · Score: 1

      I've just started learning JScript/WSH and it struck me as a problem that is very "Microsoft". If you want to automate anything by scripting you can either use batch files - which are pathetic at best, or WSH which is WAY to complicated for most people. Shell scripting with bash (or whatever shell you prefer) tends to strike a nice ballence between complexity and power that Windows could really use.

    12. Re:Shell scripting is a Lost Art by Anonymous Coward · · Score: 0

      Kampen mot kvitekrist er i gang denne nyttaarsaften... Vi vil se ham falle... langt ned... hurra! La moerket senke seg.

    13. Re:Shell scripting is a Lost Art by spongman · · Score: 1

      hood stuff. however, using the '.BAT' extension on NT doesn't cause a VDM to be started. unless, of course, you associate '.BAT' with a 16-bit executable like command.com, but by default it's associtaed with 'cmd.exe' which is a regular win32 console app.

    14. Re:Shell scripting is a Lost Art by spongman · · Score: 1

      Yup, you can tell the True Gurus in a MS-based IT department by how comfortable they are with WMI scripting. (of course, most of them will also have the cygwin tools installed for piddling around with text files).

    15. Re:Shell scripting is a Lost Art by rmdyer · · Score: 1

      You are correct. The command shell has backward compatibility with the ".bat" extension. Just for separation, I personally use ".bat" for strictly older command.com stuff and ".cmd" for command shell scripts. However, I also don't change the association, so yes, most of the application ".bat" scripts startup using the command shell.

    16. Re:Shell scripting is a Lost Art by JPriest · · Score: 1

      I have a book on my desk named automating UNIX and Linux administration, good book and almost all of the examples used are shell scripts. I use shell scripting as an extention of the existing command line and most of hte UNIX admins I know use shell script for most tasks.

      --
      Saying Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders.
    17. Re:Shell scripting is a Lost Art by Anonymous Coward · · Score: 0

      > I find it to be a very nice tool to do simple
      > jobs, without having to write a program to do
      > it...

      Simple?!?! The Korn shell is capable of handling
      a *lot* more than "simple" scripts. The Korn
      shell is capable of supporting full blown
      programs on the order of 10K lines or more.
      That's not what I would call "simple". Korn
      shell is a fully featured progamming langauage.
      Additions to the KSH93 version include (from
      the Korn shell FAQ):

      Q5 What are the major new features of KornShell
      1993?

      A5. ...Major new language features are floating
      point arithmetic, associative arrays, complete
      ANSI-C printf, name reference variables, new
      expansion operators, dynamic loading of built
      -in commands, active variables, and compound
      variables. Active and compound variables allow
      shell variables to behave like objects. In
      addition, ksh93 has been written to be exten-
      sible with an C language API for programming
      extensions.

      The Korn shell supports dynamic binding to shared
      libraries and can be embeded in 'C' programs.

      If you have never done any serious Korn shell
      programming do yourself a favor and go get a
      book on it. I strongly recommend "The New
      KornShell Command and Programming Language",
      published by Prentice Hall. Make sure you get
      this edition which describes the 1993 version
      and not the previous edition which describes
      the '88 version. You'll be *amazed* at what
      you can accomplish with Korn shell scripts
      once you *really* understand it. It isn't until
      you have spent some time programming with it
      the you will come to appreciate its power and
      beauty.

    18. Re:Shell scripting is a Lost Art by Anonymous Coward · · Score: 0

      > When I really need a program I'll turn to
      > Python or C, but 99% of the time when I just
      > need to get something done grep, find and a
      > nowledge of regular expressions does the trick.

      Sigh... Its so sad that the so many people don't
      understand the Korn (or bash) shell for what they
      really are... fully featured languages. Grep,
      find, and regexp isn't the *end* of the shell,
      it's just the *beginning*. You are doing yourself
      a big disservice if you think that the Korn (and
      bash) shells are just form simple and quick
      "scripts".

    19. Re:Shell scripting is a Lost Art by Anonymous Coward · · Score: 0

      > You are not working in a well structured and
      > cohesive language to be used for a variety of
      > application development. No, shell scripting
      > was made primarily for process and file system
      > management. Making shell scripting work much
      > beyond those means is an art, and not something
      > that should ordinarily be done because other
      > better languages should be used to fulfill
      > broader purposes.

      You make some excellent points but I would take
      exception with the above statement. The shell,
      at least Korn shell ('93), is fully capable of
      supporting "general" programming. Yes, it has
      it's limits but so does Python, or, C, or ...;
      The Korn shell is a lot more capable that just
      monitoring files and/or processes.

    20. Re:Shell scripting is a Lost Art by kfg · · Score: 1

      I never intended to imply that, I certainly didn't think it. Only that such simple scripts do most of my work.

      As they will for most people who turn to languages other than shell when there is no need.

      KFG

    21. Re:Shell scripting is a Lost Art by johnniesplace · · Score: 1

      If you're really interested in shell scripting you'll probably want to read this if you missed it beofore. Interveiw with David Korn. Its great reading for anyone intereted in shells.
      ksh is my all-time favorite, with bash a close second.

      http://slashdot.org/articles/01/02/06/2030205.sh tm l

    22. Re:Shell scripting is a Lost Art by Anonymous Coward · · Score: 0

      It isn't even that much of a lost art, because it is still extremely useful.

      As someone who is a long-time Unix guru, I get to help other people with their scripting efforts considerably.

      Some (sadly, few) of the people I help are gradually picking up the skill and learning to do things on their own, so all hope is not lost.

    23. Re:Shell scripting is a Lost Art by Wolfrider · · Score: 1

      > BTW, you can't honestly tell me you ENJOY programming in straight bash?!?!?

      --Yes. Yes, I do. And as a result I've been able to help ppl out on message boards that want to do $thing, and I can quickly supply them with a ready-made bash script that implements $thing quite nicely.

      --
      .
      == WolfriderV6 == I'm willing to admit that *I just might* be wrong... Are you??
    24. Re:Shell scripting is a Lost Art by Wolfrider · · Score: 1

      --Thanks for the link. An important point that he makes:

      "Anything that can be done with the GUI should be able to be done without the GUI via scripting."

      --Veryvery important to remember; if you don't have a GUI for whatever reason, you should still be able to get things done.

      --
      .
      == WolfriderV6 == I'm willing to admit that *I just might* be wrong... Are you??
  3. This raises an interesting question... by Anonymous Coward · · Score: 2, Insightful

    Now that we have languages such as Perl and Python, much of shell scripting has been forgotten. The need still arises for the times and places where running Perl would be just that little bit too much overhead; cron jobs, process start and stop scripts, even machine start and stop scripts.

    Now that machines are getting much faster, can we expect shell scripting to be totally forgotten and unused? Are there movements for this already?

    1. Re:This raises an interesting question... by ameoba · · Score: 1

      Generally, fast computers are used as an argument _for_ scripting languages; for a lot of things, shell scripts are still preferable to Perl/Python/etc 'cuz with shell, running external programs is very natural; there's no function calls and whatnot involved.

      --
      my sig's at the bottom of the page.
    2. Re:This raises an interesting question... by honestpuck · · Score: 1
      In thie context in which you often find yourself using a shell script 'overhead' does not just mean machine speed.

      As a sysadmin you can find yourself writing a shell script because you cannot, for example, guarantee that the volume containing anything else has loaded yet. You might also be concerned with writing a boot system that fits onto small media. You might also be writing scripts for computers in such high security situations that Perl and Python have been removed from the system.

      So ithe shell is still required as computers get faster.

      Tony

  4. As always.... by herrvinny · · Score: 1
    1. Re:As always.... by Anonymous Coward · · Score: 0

      Amazon? Do /.ers still shop there?

    2. Re:As always.... by Anonymous Coward · · Score: 0

      That's where they normally buy their CDs and DVDs.

  5. SCO by Gilesx · · Score: 2, Funny

    Maybe Darl could give a free copy away with every SCO-Linux license he sells....

    --
    Sunday you're Thinking Different, Monday you're a huge tool, paying too much and waiting to think like everyone else.
  6. Re:Kochan, Wood by RevMike · · Score: 0

    IIRC, Kochan wrote a prety good ANSI C textbook.

  7. Default shell? by christurkel · · Score: 4, Informative

    As the risk of being flamebait here, Bash is not the default shell on *BSDs (Is this the reason its dying?), its tsch. Neither is it the deault shell on QNX (ksh is). Perhaps the statement that bash is the default shell on most system seems overly broad.

    --

    CDE open sourced! https://sourceforge.net/projects/cdesktopenv/
    1. Re:Default shell? by Anonymous Coward · · Score: 0

      Bash is not the default shell on Darwin either, it's tsch.

    2. Re:Default shell? by Anonymous Coward · · Score: 0

      But, does anyone write shell scripts in tcsh?

    3. Re:Default shell? by morelife · · Score: 4, Funny

      The csh/tcsh default in freebsd is a mystery.

      When bash is ultimately so much more feature ridden than tcsh/ksh. Ok, just my observation/opinion.

      But since bash is the default shell in Linux, and there are probably more linux systems than any other unix-like platform on planet earth, I vote that bash become earth's default shell.

      Windows' default shell can probably be considered either Symantec or McAfee Anti Virus.

    4. Re:Default shell? by TCM · · Score: 1

      The csh/tcsh default in freebsd is a mystery.

      Huh? To quote master.passwd:

      root::0:0::0:0:Charlie &:/root:/bin/csh

      --
      Of course it runs NetBSD. BTC: 1NT7QvbetmANwaMzhpVL6
    5. Re:Default shell? by mgoodman · · Score: 1

      I second that motion.

      --
      01100111 01100101 01110100 00100000 01101111 01110101 01110100 00100000 01101101 01101111 01110010 01100101 00101110
    6. Re:Default shell? by stefanlasiewski · · Score: 1

      Perhaps the statement that bash is the default shell on most system seems overly broad

      He said Bourne (sh), not Bash. I'm don't agree that his statement is overly broad, Bourne is the default shell on the greatest number of installed systems. Most admins work on systems where Bourne is the default shell.

      --
      "Can of worms? The can is open... the worms are everywhere."
    7. Re:Default shell? by shuz · · Score: 1

      Default shell for AIX systems is CSH.

      --
      There is or can be built a machine that can simulate any physical object. -Church-Turing principle
    8. Re:Default shell? by morelife · · Score: 1

      I meant that the choice of csh over bash in FreeBSD - is a mystery!

    9. Re:Default shell? by the+Man+in+Black · · Score: 1

      Fairly certain it's Korn Shell (ksh).

      root@server: > echo $SHELL /bin/ksh
      root@server: > grep jrashaad /etc/passwd
      jrashaad:!:206:1::/home/jrashaad:/usr /bin/ksh
      root@server: > uname -a
      AIX server 3 4 000XXXXXXxX

      So, yeah. Unless the default shell in the 5 series has changed.

    10. Re:Default shell? by Anonymous Coward · · Score: 1, Informative
      Windows' default shell can probably be considered either Symantec or McAfee Anti Virus.
      All joking aside, on Win2000 and higher, cmd.exe is a decent shell. It's got many of the Unix shell features including redirection, basic pipes, command line editing and bash-like aliases with doskey, and nice scripting with the new command extensions. It's also possible to redirect stderr and stdout to the same file:
      C:\>dir > foo 2>&1
    11. Re:Default shell? by Anonymous Coward · · Score: 0

      bash is not even installed by default on FreeBSD, you have to install the package / port. It's well worthwhile of course.

    12. Re:Default shell? by ogre57 · · Score: 2, Informative
      .. the statement that bash is the default shell on most system ..

      Appears we interpret this differently ..

      .. chosen to use the POSIX standard Bourne shell ('bash', available on many *nix systems, is a superset of the POSIX standard).

      I read that as stating they chose the original Bourne shell, eg /bin/sh, with an aside (for Linux folks?) that bash is a superset of sh.

    13. Re:Default shell? by forrestt · · Score: 1
      I can't speak for everyone, but on the Linux systems I administer, sh is bash.
      % ls -la /bin/sh
      lrwxrwxrwx 1 root root 4 Nov 19 17:08 /bin/sh -> bash*
    14. Re:Default shell? by pete-classic · · Score: 1

      TCM,

      See that forest over there?

      Would you believe that it is made of trees?

      A better response might have been something like "Real UNIX Guys(TM) know that C is The One True Language. The choice of the C Shell is, therefore, predestined."

      Or something.

      -Peter

    15. Re:Default shell? by mlk · · Score: 1

      > Windows' default shell

      it has two, CMD.exe for interactive editing, and WSH for "scripts".

      --
      Wow, I should not post when knackered.
    16. Re:Default shell? by DrZaius · · Score: 2, Informative

      Yes, on modern systems, sh is bash. But, when you run it as sh, it runs in compatibility mode. If you try to use bash syntax when executing as /bin/sh, you will die a horrible death.

      --
      -- DrZaius - Minister of Sciences and Protector of the Faith
    17. Re:Default shell? by fizbin · · Score: 1

      You'd think so, right? Unfortunately, some minor sh extensions are still available to bash when you run it as /bin/sh, meaning that you could very easily write what you thought was a portable shell script and discover later that you'd inadvertently used some bashism.

      (There used to be occasional flame threads on debian-devel about this)

    18. Re:Default shell? by Meowing · · Score: 3, Informative

      Well, csh is the Berkeley shell, and with FreeBSD being based on BSD and all, it's just one of those things you kind of expect to see....

    19. Re:Default shell? by forrestt · · Score: 1

      Unfortunately, some minor sh extensions are still available to bash when you run it as /bin/sh

      I think you meant to say, "...some minor bash extensions are still available to bash when you run it as /bin/sh..." but I could be wrong.

    20. Re:Default shell? by abradsn · · Score: 1

      ...
      wscript host, cscript host, vbscript, javascript, csharp, asp, perl, batch processing, wmi.

    21. Re:Default shell? by Anonymous Coward · · Score: 0

      No it isn't.

    22. Re:Default shell? by GreggBert · · Score: 1

      Not the default shell on Solaris either. But it should be !

      --


      If you don't understand anything I post, please accept that I ate paste as a small boy...
    23. Re:Default shell? by Anonymous Coward · · Score: 0

      Wait, you're talking about MS, so javascript should be jscript. Would'nt want the .NETers to hear the forbidden word.

    24. Re:Default shell? by Anonymous Coward · · Score: 0

      On NetBSD, the default interactive user shell is csh. But all of the start-up routines are Bourne shell scripts, and "man sh" describes sh as the default shell for the system, whatever that means. NetBSD's sh is not quite as full-featured as bash, particularly for interactive use, but also aims for POSIX compatibility.

    25. Re:Default shell? by morelife · · Score: 1

      All joking aside, and with all due respect to you, cmd.exe is an utter and complete clumsy piece of shit. And it has been in every incarnation since command.com on DOS.

      In bash and some (most?) sh variants, and ksh, and I believe the C shell families, which have substitution and string handling ability, you can do things like:

      foo=sharkattack
      echo ${foo/ark/---}

      or

      for file in $(ls -1 *.pls); do
      mv $file $(echo ${file%%.pls}); done

      So, with a little creativity, and not all that much effort, you can do some pretty high level operations in the OS without touching perl or C, including having some getops functionality, and long variables, etc.

      IF only these shells could handle arrays like perl.

    26. Re:Default shell? by i_r_sensitive · · Score: 1
      Then why when folk refer to Shell Replacement for Windoze that explorer is allways the targeted executable?

      I think a pretty strong case can be made for explorer over cmd as the default windows shell. CMD.exe is really nothing more than a command line interface to explorer. It implements only a narrow subset of explorers capabilities, relies on explorer much like any other called program for process control, filesystem access, etc. etc. etc.

      As for WSH, forget it, same paradigm, different implementation.

      Now if you want a real shell... this is about as close as you're going to come.

      --
      "Talk minus action equals nothing" - Joey Shithead, D.O.A.
      "Talk minus action equals /." -
    27. Re:Default shell? by Anonymous Coward · · Score: 0

      Yuck. How about zsh?

    28. Re:Default shell? by Anonymous Coward · · Score: 0

      You, sir, are a turbo-assholio.

      for file in $(ls -1 *.pls); do

      for file in *pls;do

      Brett Glass

    29. Re:Default shell? by mph · · Score: 1
      Yes, on modern systems, sh is bash.
      Huh? I think you mean "Linux", not "modern systems."

      hal-9000:~$ uname -sr
      SunOS 5.9
      hal-9000:~$ ls -l /bin/sh `which bash`
      -r-xr-xr-x 4 root root 95488 Apr 6 2002 /bin/sh*
      -r-xr-xr-x 1 root bin 578964 Mar 2 2002 /usr/bin/bash*

      wopr:~$ uname -sr
      FreeBSD 4.8-STABLE
      wopr:~$ ls -l /bin/sh `which bash`
      -r-xr-xr-x 1 root wheel 460200 Jul 21 15:39 /bin/sh*
      -rwxr-xr-x 1 root wheel 893200 May 15 2001 /usr/local/bin/bash*
    30. Re:Default shell? by TCM · · Score: 1

      Scripting in csh is considered harmful. Since real console lovers don't differentiate between interactive use and script writing, this also applies to csh as an interactive shell. So no, csh is not the shell of choice, at least not for me.

      --
      Of course it runs NetBSD. BTC: 1NT7QvbetmANwaMzhpVL6
    31. Re:Default shell? by Anonymous Coward · · Score: 0

      Sorry I'm AC, this is the first time I've posted to /. after reading it for a long time. tcsh used to be the default shell in Darwin, as of the Darwin release that equates to 10.3, it is bash.

      Charles

      (So you know who to flame.)

    32. Re:Default shell? by JDizzy · · Score: 1

      The reason is not a mystery at all. Bill Joy, the creator of VI, NFS, PASCAL, BSD, and a CSH, wrote CSH because bourn was not very interactive. Saddly csh/tcsh are utterly unsuitable for shell scripting (the point of this thread), and bourne shell was preserved to do scripting in hetrogenius envirments. So due to this long Berkley heritiage, tcsh remains in the BSD distro's. As far as bash, well tcsh has all the same interacti ve features as bash does, so there is no real reason to include bash, especially since it has a viril license based on the FSF license. Since TCSH is truely free, it is more desirerable on a philisophical basis. So in this way you can see that tcsh, and bash have the same easy of use in daily interactive tasks, but tcsh doesn't have any license that it not so free. The choice seems very clear to me.

      --
      It isn't a lie if you belive it.
    33. Re:Default shell? by Anonymous Coward · · Score: 0
      It implements only a narrow subset of explorers capabilities, relies on explorer much like any other called program for process control, filesystem access, etc. etc. etc.
      It may start as a subprocess of explorer, but it doesn't have to. Start up Windows in safe mode with the command prompt, fire up task manager and you'll see that explorer is nowhere to be found.
    34. Re:Default shell? by morelife · · Score: 1

      Since TCSH is truely free, it is more desirerable on a philisophical basis.

      I didn't realize that because I don't use tcsh at all but thanks for pointing out the licensing thing here. And agreed - the GPL is less desirable - really the BSD license is the way to go and I'll continue using it in the future (tropism)

      Does tcsh/csh have more "interactive" features than bourne? On the command line? I've never gotten this... what, for example? Thanks

    35. Re:Default shell? by Anonymous Coward · · Score: 0

      I guess I don't see how bash's license would have "viral" effects. It's not like you're going to incorporate bash into another program; it's a shell. And I doubt that bash's license can affect the scripts written on it. Maybe this is a misunderstanding of bash's license on my part, but there's a reason it's used even on non-free UNIXes.

    36. Re:Default shell? by Discoflamingo13 · · Score: 1

      That's why you should test your shell scripts with something like ash, instead of trusting a more advanced shell to behave appropriately in all circumstances. ash is a POSIX compliant clone of the original sh.

    37. Re:Default shell? by pete-classic · · Score: 1

      I wasn't lobbying for csh. I was illustrating that your answer was from a different plane of existance than the question.

      Someone is having trouble communicating here. Since morelife and I have had similar problems communicating with you I will draw the preliminary conclusion that you have a weird world-view*.

      -Peter

      *More power to you.

    38. Re:Default shell? by JDizzy · · Score: 1

      Does tcsh/csh have more "interactive" features than bourne? On the command line? I've never gotten this... what, for example? Thanks

      Well sure, you got history, tab completion, improved job control, etc. TCSH is just as interactive as BASH. Bash and TCSH have many things incommon in regards as the users point of view, and ease of use. However, both shells are not suitable for portable shell scripting, like bourne shell is. One difference is that TCSH is utterly unsuitable for shell script, as it is designed to be an interactive shell, where Bash is more script friendly. This last point saddly leadcs some folks to belive that it is ok to script in bash, which leads to bad scripts.

      --
      It isn't a lie if you belive it.
    39. Re:Default shell? by mefus · · Score: 1

      The

      mv $file $(echo ${file%%.pls})

      seems silly, too.

      mv $file ${file%%.pls}

      works just fine, in a script.

      --
      mefus
      In Open Society, GPL Software frees YOU!
    40. Re:Default shell? by calidoscope · · Score: 1
      All joking aside, and with all due respect to you, cmd.exe is an utter and complete clumsy piece of shit. And it has been in every incarnation since command.com on DOS.

      To put things in perspective, the *-DOS 1.x could be fit in 16 to 20 kB of RAM which included both COMMAND.COM and a couple of kB for the FAT. Not surprising that it didn't do much. OTOH, M$ was kinda slow updating the utilities, e.g. EDLIN didn't go away until DOS 5.0 (Tim Patterson was planning to have a successor ready sometime in 1981).

      There was a package to put UNIX shell like functionality on the Z-80 - but it took up 32 kB of RAM (out of 64 kB available).

      --
      A Shadeless room is a brighter room.
    41. Re:Default shell? by AhBeeDoi · · Score: 1

      Does it matter what the default shell is when a user can very easily change to his preferred shell?

    42. Re:Default shell? by TCM · · Score: 1

      Yes, perhaps you should stop talking about forests and trees and little fairies and gnomes and stuff.

      --
      Of course it runs NetBSD. BTC: 1NT7QvbetmANwaMzhpVL6
    43. Re:Default shell? by Anonymous Coward · · Score: 0

      Yes, as we're talking about shell programming, not shell users. Just imagine trying to run a Python script with Perl, or vice versa. That's the reason for this little line at the top of shell scripts:

      #! /bin/sh

      Introduced in BSD, this tells the operating system to execute the file as a /bin/sh script. /bin/sh is available on all Unix systems, without exception (unless you're a freak and remove it), which is why it should be used for shell scripts which are not specific to one system, but may need to be redistributed.

    44. Re:Default shell? by robhancock · · Score: 1

      CMD is not a command line interface to Explorer. It doesn't rely on Explorer for process control or file system access at all, those are Win32 functions, the same as Explorer or any other Win32 app calls.

      I think if one were so inclined, you could change the Windows shell from explorer.exe to cmd.exe and just give yourself a command prompt when you logged into the machine, with no explorer.exe running at all.

    45. Re:Default shell? by Anonymous Coward · · Score: 0

      I don't care about what the default shell is, I seldom use the default anyhow (except Bourne shell for single-user mode).

      The fact that bash is the default anywhere for any reason other than being GNU software is a mystery, considering that zsh is so much more featureful... C'mon, please don't expect me to live without tab-expansion of wildcards and history references!

    46. Re:Default shell? by i_r_sensitive · · Score: 1
      Regardless of the merits of any arguments I or any other put forward, it is rather compelling when Microsoft themselves refer to explorer.exe as the shell. Then the argument becomes is M$ right to call explorer a shell. In any case, M$ pretty clearly means for explorer.exe to be your shell, not cmd.exe.

      Beyond that, there is pretty conclusive evidence that cmd.exe exists for no other reason than to provide backwards compability for some applications. After all the program in that namespace harkens back to NT. It was quite clear to me using it on those early NT boxes that cmd was not DOS, but sufficiently DOS-like to keep most apps happy. Throughout that products life, and it's direct descendants we did not see development of cmd.exe into a real shell either. Rather, those shell functions which were missing were built into explorer or other new programs, like WSH.

      In point of fact, you can change your default shell from explorer to any executable, typically this is referred to a shell replacement, indicating that the common use of the term co-incides with Microsoft's use of the term, which is that explorer.exe is the shell. None of the people writing Windows shell replacements provide you an alternative to cmd.exe, and they are right not to do so, because CMD is not the shell.

      Go ahead and try replacing your default shell (explorer.exe) with cmd.exe. I will suggest you will not be able to accomplish any of the tasks you routinely do with that machine. Because you speicifed a program which was not meant to be a shell, it cannot fulfill all the tasks which M$ expects a shell to provide. The semantic difference of wether cmd acesses explorer directly or accesses the same function directly is moot, cmd can not provide complete shell services for a Windows machine, at best it could be used to invoke a full blown version of explorer, or another complete shell. Functionally it is a CLI interface, maybe not directly to explorer, but a limited subset of the indetical functions as explorer. While conceptually, it is not an interface to explorer, functionally, it may as well be.

      --
      "Talk minus action equals nothing" - Joey Shithead, D.O.A.
      "Talk minus action equals /." -
    47. Re:Default shell? by i_r_sensitive · · Score: 1
      Great! Now open up the document I just sent you without rebooting, and without invoking explorer or another complete shell replacement.

      What's wrong? Apparently explorer is the shell, which was my point. This straw man attack is complete fluff.

      In any case, try doing exactly what you suggested. Okay, now, type exit in cmd, press CTRL-ALT-DEL and select task manager. Well, lo and behold, no cmd there either. In point of fact, Winlogon.exe is the responsible program at that point, but we don't confuse winlogon as being the shell do we...

      That M$ includes shell-like capabilities to other programs via the same libraries that explorer uses does not nullify explorer as the shell, nor is it necessarily good programming practice.

      You don't like that single assertion, fine, I admit it isn't the most accurate statement I've ever uttered, but if you are pretending that your argument in any way impinges on my assertion that cmd is not the shell and explorer is, there is a law firm in Utah which could make use of your talents in the straw man attack.

      --
      "Talk minus action equals nothing" - Joey Shithead, D.O.A.
      "Talk minus action equals /." -
    48. Re:Default shell? by AhBeeDoi · · Score: 1

      Same difference. Fyi, it's called the shebang.

    49. Re:Default shell? by Pete · · Score: 1

      Sometimes talking about things in those terms can be an effective way to illustrate things. And sometimes not ;-).

      On-topic - I used tcsh as my interactive shell from about '94 to '96. It pissed all over bash back then (purely from the interactive perspective). However, AFAICT, bash has improved quite a bit since then and has probably been superior to the latest tcsh for a while - in fact, is tcsh being actively developed anymore? It's probably an evolutionary dead end, to put it mildly :).

      But anyway, bash is still not in zsh's league. ;-)

      Pete.
  8. Shell scripting is great, even in Windows! by simetra · · Score: 3, Informative

    I use shell scripts for many things under Windows using the free version of many Unix utilities found HERE. Scripts are fast, and don't break (short of being over-written). Many times, scripts can be written that perform the functionality of expensive Windows programs, with the advantages of being free, not easily broken, and not subject to dll version issues, continual upgrades, etc, etc, etc.

    Shell Scripts are really The Cat's Pajamas.

    --

    "Would it kill you to put down the toilet seat?" -- Maya Angelou
    1. Re:Shell scripting is great, even in Windows! by hey · · Score: 1

      The best thing about shell scripts in Unix is that you can count on it working on pretty much any Unix/Linux if you are careful. If can't send a Windows user a shell script and say "run this".
      You gotta say: download things thing and run this.
      Not so nice.

    2. Re:Shell scripting is great, even in Windows! by gatkinso · · Score: 1

      Run your non trivial bash script under csh.

      Hmm.....

      --
      I am very small, utmostly microscopic.
    3. Re:Shell scripting is great, even in Windows! by compass46 · · Score: 2, Informative

      That's why you write your scripts for sh since posix says that sh shall exist on your system.

    4. Re:Shell scripting is great, even in Windows! by simetra · · Score: 1

      Aye, weenie Windows users can have their GUI toys and feel important. I use scripts to get actual work done, and on servers to make stuff run clean and good.

      --

      "Would it kill you to put down the toilet seat?" -- Maya Angelou
    5. Re:Shell scripting is great, even in Windows! by gatkinso · · Score: 1

      True, but the quote from the topic that leaps to mind is, "The authors have chosen to use the POSIX standard Bourne shell ('bash', available on many *nix systems, is a superset of the POSIX standard). That seems the right decision, given that it is so universally available and usually the default shell."

      Sh is a little spartan also... not to argue the relative merits of the various shells (my work requires us to use tcsh of all things) but the posters point about portability was, well, ridiculous.

      --
      I am very small, utmostly microscopic.
    6. Re:Shell scripting is great, even in Windows! by AhBeeDoi · · Score: 1

      Shebang, anyone?

  9. Oldie, but goodie differences ... by pgrote · · Score: 5, Interesting

    When I first started learning about the concept of shells, I was moving from the MSDOS world.

    One of the first things I remember reading was the FAQ describing the shell differences.

    Imagine my surprise that the command line could hold so much control and there were other aspects of controlling a PC. I haven't looked back since, but that page really brings back some memories.

    It's funny how something you read can cause one of those lightbulb moments.

    1. Re:Oldie, but goodie differences ... by mefus · · Score: 1
      That's a nice link, but it's outdated. From the fine manual:
      Bash provides onedimensional array variables. Any variable may be used as an array; the declare builtin will explicitly declare an array. There is no maximum limit on the size of an array, nor any requirement that members be indexed or assigned contiguously. Arrays are indexed using integers and are zerobased.
      --
      mefus
      In Open Society, GPL Software frees YOU!
  10. The Land of the Lost by RevMike · · Score: 2

    Back when dinosaurs roamed the earth and NCR made Unix computers

    I used to work on an AT&T 3b2. I can also script pretty well in DCL. Does that make me a sleestak?

    Extra points for anyone younger than 30 who can prove they actually know DCL. Demonstrate something good - maybe set up IPC using mailboxes or something.

    1. Re:The Land of the Lost by AnonymousNoMore · · Score: 1

      Shell scripting. Pfffft! My first professional coding gig (right out of high school) was on an NCR machine using NEAT/3 punched onto cards. We didn't have any fancy pants shell scripting, and we liked it.

    2. Re:The Land of the Lost by forrestt · · Score: 1

      Extra points for anyone younger than 30 who can prove they actually know DCL.

      Shoot, I'd give extra points for anyone younger than 30 that actually knows what a sleestak is!

    3. Re:The Land of the Lost by theendlessnow · · Score: 1

      Unemployed. Hire me in NYC/Long Island area. Java-J2EE-PL/SQL-Pro*C-Perl-XML ...AND DCL!!

    4. Re:The Land of the Lost by L10N · · Score: 1

      indeed! ::mourns his youth::
      somewhere back I transitioned from angry young man to angry old man in seemingly a blink of the eye...

      --
      "What we do in life echoes in eternity." Maximus Decimus Meridius
    5. Re:The Land of the Lost by axxackall · · Score: 1
      Demonstrate something good - maybe set up IPC using mailboxes or something.

      10 years ago I've created document-oriented transactioned RPC based on Sendmail, Procmail, PGP, and Shell scripting (and OraTCL). It was secure and reliable on very unreliable phone lines (ever connected with 1200 bod ?). Does it give me any points? :)

      --

      Less is more !
  11. Re:wtf is up with this RACISM? by twocents · · Score: 1

    I cannot tell if you are being sarcastic, but it's pretty easy to see that his comment was, well, sarcastic, making fun of others that use the word.

  12. Old use of scripting by andy666 · · Score: 1

    Scripting was used as a term for the code of the 1960s Terry Winograd robot SHRDLU, that would reason about geometric objects.

  13. Missing the point. by Saeed+al-Sahaf · · Score: 1
    I wouldn't call it a lost art, but with all the advancements in GUI, it certainly doesn't get used as much as it should.

    Shell scripting is not the same as command line. Yes, many tasks that one does on the command line can now be done in a more friendly way with GUI, but shell scripting != command line. Think of the word "scripting" and what this means: A task that requires some steps, and my possibly be carried out automatically (perhaps with cron or some other daemon...). I would say something rude and stupid like "go back to your Win box and rejoice in your ignorance", but I probably shouldn't.

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:Missing the point. by MoonFog · · Score: 1

      hink of the word "scripting" and what this means: A task that requires some steps, and my possibly be carried out automatically (perhaps with cron or some other daemon...).
      I know what scripting is, my point was that KDE, Gnome etc, hell, even Windows have programs or "stuff" in the GUI that will let you set up what you want to run, when, and what you want it to do. You do not NEED to write a script to do it!

    2. Re:Missing the point. by AhBeeDoi · · Score: 1

      Well, sometimes I need to do something, something silly and not worthy of a full blown gui-based application which would be overkill. I needed to help me record the contents of hundreds of cdroms with their filenames, file date, file size, cd volume name, extension, subdirectory location on a file that I could import into a database. There may be some old *nix app that does that but I don't really have the time to search for it and anything I find would probably be lacking in some area. My solution is to fire up kwrite (I never liked vi for anything other than editing) and write a script to do that for me. Shell scripting may seem to be eclipsed by perl and python but it still has its (modest) place in the *nix environment. Plus scripts are still being used for many admin tasks despite the existence of may GUI tools.

    3. Re:Missing the point. by johnniesplace · · Score: 1

      Well you're right to a point. But it brings about a something about this subject that puzzles me greatly. Why would anyone think shell scripting is hard? The real posix hands write shell scripts every day in a single line at the command pompt. Stuff like

      ps -elf | grep pine | awk '{print $4}' | \
      xargs -i -t kill{}

      well ... its just saving it in a file away from being a shell script. So what's the big deal? Lost Art? Give me a break.

      While I'm at it let me walk down memory lane for a
      couple of shell stories. When I was just starting out in Unix (around 1988) at a big three initial corporation and I first found out about ksh (Command line editing! My life was changed!) I though "korn shell" was a play on words because of the unix "kernel" - Get it? Korn; Kernel? Hey, I was young then.

      Later on me and a buddy were working on third level support for NFS. Lots of people were having problems because ksh kept its history file consistent by setting a flock on the history file and if they were keeping it in the home directory over NFS if NFS file locking failed - which was
      pretty common at that time; the file history would get hosed. I walked into our office one day and heard my buddy Paul talking to somebody on the phone about the problem. When he hung up I asked who he was talking to. He'd decided to just call Bell Labs and asked for David Korn to ask why he used a file lock on the history file. He got through to him and David said it just seemed like a good idea at the time. We changed the three initial corp's flagship posix product's ksh implementation to not use flock and I believe it's the same way today.

      Shell scripting is your friend on any platform.

    4. Re:Missing the point. by Wolfrider · · Score: 1

      --Isn't that code fragment the same as doing a ' killall '?

      --On the other hand:
      > I walked into our office one day and heard my buddy Paul talking to somebody on the phone about the problem. When he hung up I asked who he was talking to. He'd decided to just call Bell Labs and asked for David Korn to ask why he used a file lock on the history file. He got through to him and David said it just seemed like a good idea at the time. We changed the three initial corp's flagship posix product's ksh implementation to not use flock and I believe it's the same way today.

      +1 Awesome Anecdote

      --
      .
      == WolfriderV6 == I'm willing to admit that *I just might* be wrong... Are you??
  14. Or, for the free speech *and* beer people by Zocalo · · Score: 4, Informative

    The LDP includes the "Advanced Bash-Scripting Guide" which is available in both HTML and PDF (1MB!) formats, and there is even a version for PalmOS! Since I found it, it's been the only reference I've *ever* needed when I've stumbled over some obscure nuance of shell scripting.

    --
    UNIX? They're not even circumcised! Savages!
    1. Re:Or, for the free speech *and* beer people by iantri · · Score: 1
      I tried reading Advanced Bash-Scripting Guide.. well, you're right. It's a reference. No good for learning about scripting.

      Can anyone point me to something (other than the reviewed book) I can read to learn about shell scripting?

    2. Re:Or, for the free speech *and* beer people by Anonymous Coward · · Score: 0

      "Unix Shells by Example" by Ellie Quigley. It has examples of csh, tcsh, sh, bash and ksh scripts, as well as lab exercises in each chapter.

      Highly recommended for both novice and experienced unix users/admins.

    3. Re:Or, for the free speech *and* beer people by Anonymous Coward · · Score: 0

      Posting as AC, you can guess why. The best book I ever saw for shell scripting has *got* to be O'Reilly's Unix Power Tools. You'd be amazed at what those guys did, and they did it with a *lot* less machine than we have now. Includes a CD full of Good Stuff (TM), BTW.

    4. Re:Or, for the free speech *and* beer people by Anonymous Coward · · Score: 0

      man bash

    5. Re:Or, for the free speech *and* beer people by abradsn · · Score: 1

      I have the book, and I like it.

    6. Re:Or, for the free speech *and* beer people by Anonymous Coward · · Score: 0

      bash woman

    7. Re:Or, for the free speech *and* beer people by Zocalo · · Score: 1
      I tried reading Advanced Bash-Scripting Guide...

      Not too closely it appears, since as it says in bold on the front page "the only way to really learn scripting is to write scripts". It's right. There seems to be a view amongst people who "can't" write shell script that it needs to be taught which is utterly wrong. It is not an arcane programming language like C for crying out loud; it's the commands you use at the command line *every* day, unless you are entirely reliant on a GUI.

      The only major difference is that you have core programming contructs like loops and conditionals to play with as well, although the true hacker would say that's wrong since you can actually use all those from the prompt too! What you *need* to write effective shell scripts are:

      • The Unix "man" pages.
      • A good reference.
      • Some example scripts; there's a bunch under /etc. You can learn *far* more from looking at a good real example than anything else.
      • A grasp of programming "style"; indentation and so on. Again, real examples are good.
      • A little time and nous.
      The reference is optional (it was for me, my only reference was "man"), but does help to speed up the process somewhat. You most certainly do not need a step by step tutorial or, heaven forbid, to drop a few hundred on a "training course".

      I can (and frequently do) write stuff in shell that I gather from the comments in this article most people would have used Perl/Python/Ruby/... for. Sure, it's slower, less efficient, and I guess it kind of makes me into a bit of a dinosaur, but you know what? I don't care! I *know* I can be sat down in front of a shell prompt on any Unix system, anywhere, and get the job done with what is there. No need for any niceties like change requests to get my scripting language of choice installed, waiting for compilations, or anything like that. These days the Perl coders might be able to get away with it, but how many other scripting language only guys can claim that?

      --
      UNIX? They're not even circumcised! Savages!
    8. Re:Or, for the free speech *and* beer people by iantri · · Score: 1
      Hi there. Do you need help down from that soapbox? ;)

      Yes, shell scripting seems obvious, I would have just liked something less intimidating than an A-Z reference (maybe a limited subset that just covers the bit you need to get started).

      Advanced Bash Shell Scripting conveniently glosses over somethings like how variables work in a Bash script and so on. (or at least, if it's there it isn't well explained).

    9. Re:Or, for the free speech *and* beer people by Anonymous Coward · · Score: 0

      Og bash troll! bash bash bash!!

      Hmm, now where did Og put BFH...

  15. Try learning .NET by Anonymous Coward · · Score: 0

    It might help you with that "unemployed" thing you got going on...

    1. Re:Try learning .NET by Anonymous Coward · · Score: 0

      Programming in .Net would make me unemployed fast enough.

  16. Re:wtf is up with this RACISM? by Anonymous Coward · · Score: 0

    You must be trying to do for sarcasm what Alanis Morrissette did for irony.

  17. TROLL by Anonymous Coward · · Score: 0

    the language has not changed noticeably in twenty five years (just like CmdrTaco and his underwear!) and should not change in another twenty five.

    Clever monkey.

  18. I did some work for him on this book by Jack+Wegnar · · Score: 3, Interesting

    Patrick's research staff contacted me two years ago and I did some minor work for him, via email (I never met him so don't go all crazy and ask for details) and was paid very well, considering it was research for a book.

    Patrick's a pretty sharp guy but he outsources a lot of his research to proffesionals (makes sense) and has several staff people help him put the pieces together, as it were.

    I offered my services as part of the FTEST (final tech editing service team) but Patrick didn't want a publishing pundit as much as he was looking for computer pundits. Ah well, at least now I'm in his rolodex and hopefully I'll get more chances to work with him.

    Warmest regards,
    --Jack

    1. Re:I did some work for him on this book by Anonymous Coward · · Score: 0

      Please enlighten us: what research did you do for this book?

    2. Re:I did some work for him on this book by kin_korn_karn · · Score: 1, Troll

      he worked on the chapter on name-dropping and brown-nosing

    3. Re:I did some work for him on this book by The+Ape+With+No+Name · · Score: 1

      Actually, I did something similar. I ghostwrote all of Michel Foucault's work (that was my beltbuckle imprint fading on his forehead at the Stanford lectures) and did Abelard's research via a time machine.

      --
      Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
  19. Download scripts and errata here by Helevius · · Score: 5, Informative
    You can download their scripts and fixes for the text at http://www.kochan-wood.com/.

    The one Amazon.com review gave this book 4 stars.

    Helevius

  20. Shell scripts by RealProgrammer · · Score: 4, Insightful

    I make my living as a Unix sysadmin, to support my hobby as a Real Programmer :-p.

    Without shell scripts, I'd be lost.

    Shell scripts provide the ability to leverage the work of every well-behaved perl (etc.) script, binary in /bin, and other shell script ever written. While the same can be said for perl scripts (which I happily use or write when needed), with shell scripting this is the intended paradigm.

    Scripts are intrinsically open source, even if copyrighted and under a closed license. The techniques are visible, and thus instructive.

    Given Unix's design attribute of easy process creation, shell scripting is often the best way for me to handle a task.

    See some examples here.

    --
    sigs, as if you care.
    1. Re:Shell scripts by mr_mischief · · Score: 1

      Uncompiled != Open Source

      You can be sued, arrested, fined, and even jailed for reusing copyrighted code that has not been translated into machine code.

      Stealing someone's expression of an idea displayed on a compouter terminal is no different from stealing someone's expression of an idea displayed on the pages of a book.

    2. Re:Shell scripts by scotch · · Score: 0

      Yeah, they're both not stealing, but instead possible copyright infringement or contract violations. Begin "stealing != copyright infringement" flame war here ->

      --
      XML causes global warming.
    3. Re:Shell scripts by RealProgrammer · · Score: 1
      Scripts are intrinsically open source, even if copyrighted and under a closed license. The techniques are visible, and thus instructive.

      Ok, slowly: notice the use of lower case in "open source". Notice the next sentence, which talks about techniques being instructive. Copyright does not disallow copying verbatim into your head. Once in your head, you can examine it any way you wish. You can even write it down. You just can't let someone else have a copy.

      But the point about techniques being instructive is that ideas and techniques are not copyrightable. Facts such as mathematical formulas are not copyrightable. The code is what is copyrightable, as an expression of an idea.

      If ideas were copyrightable, there would be only about six country and western songs.

      --
      sigs, as if you care.
  21. what a coincidence by digitalsushi · · Score: 1

    The quote for this page when I loaded it:

    "It is easier to port a shell than a shell script." -- Larry Wall

    --
    slashdot: where everyone yells sarcastic metaphors to themselves to understand the issue
    1. Re:what a coincidence by Dr.+Smeegee · · Score: 1

      Thanks, I now have half-chewed Little Debbie Oatmeal Cream Pie in my keyboard.

      Damned reality...

    2. Re:what a coincidence by IM6100 · · Score: 1

      That's spelled 'Little Debian' when you're on slashdot.

      Try the new maple cream pies. They're good too.

      --
      A Good Intro to NetBS
  22. "the language of virii", oh please by Anonymous Coward · · Score: 0

    A virus can be written in any language. Saying that VBScript is "the language of virii" just goes to show your fanboy-ism. Also, don't equate IT gurus by their shell scripting capabilities. I'd much rather write general tasks in Ruby or Perl than that hackjob, ugly-ass shell language anyday.

    1. Re:"the language of virii", oh please by Saeed+al-Sahaf · · Score: 1

      It's an "observation" that many, a lot, a significan number... Are written in VBScript (a language I have made MUCH use of while employed as a MS SQL Server admin...).

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    2. Re:"the language of virii", oh please by Anonymous Coward · · Score: 0

      It's not the language, it's the lax permissions set on the components/controls that VBScript can access. The language itself has little to do with all the viruses. I'm not defending VBScript (only a tard would write anything serious in that POS language), but I can't stand misguided anti-MS crap either.

  23. Re:wtf is up with this RACISM? by Anonymous Coward · · Score: 0

    I cannot tell if you are being sarcastic, but it's pretty easy to see that his comment was, well, sarcastic, making fun of others that use the word.

    I find it offensive. You may find it sarcastic, but it is still inappropriate, rude, and insulting. Cowboy Neal should change it, at least put a couple of **'s in there. We would still know who he is talking about, and it would be much more civilized.

  24. Ah, DCL by fizbin · · Score: 1

    I was just mourning the fact that the internet wayback machine's archives didn't include the collection of VMS .COM files I had set up on our campus's VMS cluster. (Running OSU's webserver for VMS)

    Unfortunately, it's almost all left me, though I suppose I could still puzzle out the quoting rules to pass quoted arguments down three levels of @-signing. (Doubling the quotes each time...)

    And hey, _I'm_ still under thirty (for two more years...)

  25. Please pull your head out. by Saeed+al-Sahaf · · Score: 1

    Just because many shell scripts are hack jobs does not mean that this is the way they need to be. So, are you telling me that all Perl and Ruby looks like it should be put in the Louvre ? Sounds to me like either you don't know how to shell script, or you don't know how to shell script well .

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:Please pull your head out. by Anonymous Coward · · Score: 0

      Bite me, fanboy. I don't like shell because of it's hideously ugly syntax. I can script just fine in any language I'm comfortable in, perfectly readable, appropriately commented and all that. If you like shell, then code to your heart's content, just realize some of us would rather deal with a language that doesn't look like several decades of hack-upon-hack.

    2. Re:Please pull your head out. by Anonymous Coward · · Score: 0

      some of us would rather deal with a language that doesn't look like several decades of hack-upon-hack.

      Oh, you mean like Perl???

      Anyone seriously suggesting that Perl is more readable than a shell script is simply insane. Yes, Perl is a lot more powerful on its own (without relying on external Unix tools), but it is not readable. It is rarely commented well and it relies heavily on implied constructs and context. I've used Perl heavily for a few years and it's saved my butt a few times and I'm still not a big fan.

      Now Ruby, on the other hand, is very clean, has none of Perl's clever-little-hack quality to it, and rarely needs to be commented at all because well-written code looks like pseudocode anyway. I would take Ruby over shell programming any day. Except that Ruby modules to replace standard Unix tools are sorely lacking, either in development status or in documentation. But that's ok, because using backticks from within Ruby I can get all the benefits of Unix combined with all the benefits of Ruby.

  26. HEY LOOK AT ME! PAY ATTENTION! by Anonymous Coward · · Score: 0

    I'm a stupid 13-year-old white boy from Utah! My mommy won't let me say naughty words out loud so I go on the interweb and post PEE PEE POO POO DOODY HEAD words, then I go giggle like the little skidmark I am! OMG I AM SO TEH FUNNEY ROFFLES

  27. OMG! MOD PARENT DOWN! by Anonymous Coward · · Score: 0

    Do NOT click the Amazon.com link in the parent poster's message! It is a dirty trick! Instead of going to Amazon like I wanted it went to this site called "www.tubgirl.com" and it shows this AWFUL and DISGUSTING picture of a lady pooping all over herself! It is WAY GROSS, DO NOT click that link! Why doesn't Rob Malda BAN such bad people from this site? It is so mean to link to nasty pictures like that!

  28. /bin/bash as /bin/sh considered harmful by fizbin · · Score: 1

    That works just fine until some update to readline, or ncurses, or any of the other libraries the monster that is bash depends on happens to break your shell. Then, you're off to alternate boot media.

    It's fine to have bash as your everyday user shell. It's even ok to have it as your default shell for root, though having a second uid 0 login with some more minimal shell (like ash, for example) is often a good idea. However, I wouldn't make it as absolutely essential for the system as it is when it's /bin/sh.

    Personally, I take advantage of the setup provided by the Debian package sash, which provides a statically linked shell for /bin/sh and a secondary root login that uses that shell.

  29. Cheaper at bookpool . . . by buzzdecafe · · Score: 1
  30. Get a clue. by Anonymous Coward · · Score: 0

    "('bash', available on many *nix systems, is a superset of the POSIX standard). That seems the right decision, given that it is so universally available and usually the default shell."

    Once you move to real UNIX platforms, Solaris and BSD for example, bash is never the default shell, and rarely does it even come with the system.

  31. Really the better one is this one: by funwithBSD · · Score: 3, Informative

    UNIX(r) Shell Programming, 4th Edition


    Of the same name, not related. Go figure. I got both and the one above is the better of the two, IMHO. Chapter 5 of this one is golden, lots of simple tables covering built in operaters, varibles, and control structures.

    I really did not GET programming until the book above, it made it click for me. Perl came right after, as this got the concepts in my thick head.

    A shell-less admin is a useless as a mermaid, and not as pretty to look at.

    --
    Never answer an anonymous letter. - Yogi Berra
    1. Re:Really the better one is this one: by Anonymous Coward · · Score: 0

      > A shell-less admin is a useless as a mermaid, and not as pretty to look at.

      Dont you say that to all those sailors !

    2. Re:Really the better one is this one: by funwithBSD · · Score: 1

      USN Retired.

      Best thing about mermaids is they breath with gills. No coming up for air.

      --
      Never answer an anonymous letter. - Yogi Berra
    3. Re:Really the better one is this one: by IM6100 · · Score: 1

      And the worst thing about mermaids is they're all fish from the waist down.

      Not an issue if you're in the Navy, of course...
      *rim shot*

      --
      A Good Intro to NetBS
  32. Automatic quote rotation? by basso · · Score: 2, Interesting

    Is it coincidence that the quote at the bottom of this page currently is:
    "It is easier to port a shell than a shell script." -- Larry Wall
    ?

  33. Shell scripting is deprecated by ultrabot · · Score: 0, Troll

    What's the point in writing scripts in sh anyway? These days you can use more powerful and less fragile languages like Python. Shells have crappy error handling, complex escaping rules and generally they create more problems than they solve.

    In Python, you can easily read the contents of executing programs popen, and likewise write the processed output to other processes also via popen. More facilities exist for error handling, logging and other general "growth" paths of the scripts.

    Choosing to write something over 4 lines in a shell scripting language (sh) is a sign of incomptence, nothing else. Sysadmin should still IMO be competent enough to grok more structured languages like Python. It's not the windows world after all...

    Sysadmins should also be responsible enough to consider that someone might want to edit the script after him. Shell scripts tend to break w/ editing.

    Moderators: reply instead of modding down. Tell us why someone should prefer a crippled language when more advanced (and still equally easy to use) technology still has uses. History alone doesn't warrant it.

    UserLinux is IMHO taking the right road, in suggesting that scripts be written in Python.

    --
    Save your wrists today - switch to Dvorak
    1. Re:Shell scripting is deprecated by ultrabot · · Score: 1, Interesting

      Tell us why someone should prefer a crippled language when more advanced (and still equally easy to use) technology *) still has uses.

      *) is available.

      It's new years eve, wine made me do the grammatcal/semantic error.

      And thanks, anonymour moderator, for the "troll" moderation. Want to silence any discussion that touches too close to the home, right?

      --
      Save your wrists today - switch to Dvorak
    2. Re:Shell scripting is deprecated by ChristTrekker · · Score: 3, Informative

      The shell is universally available. On some low-end systems (yes they still exist), Python and even Perl might not be installed.

    3. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0
      For one thing, launching processes or manipulating the file system (which is the only reason for a scripting language) is going to be much more verbose in Python. Python will make you do incredibly stupid and redundant things like open files.

      Secondly, injecting a filter between pipes in Python means either reading in the input entirely (waste of memory), or reading it piecemeal (verbose and unnecessary). With the shell, you inject a sub-process. The end result is that with the shell, you write it as if you the input were all one big chunk, but it only takes up the amount of memory of reading it piecemeal. Filtering in the shell is effectively lazy evaluation, whereas Python forces strict evaluation, which is very much inferior.

    4. Re:Shell scripting is deprecated by buysse · · Score: 1
      At boot time or in single-user mode, I may or may not have /usr. Unless you have a statically-linked mini-Python, I'll stick with /bin/sh for a good percentage of things.

      Of course, I know where to draw the line. Another sysadmin here wrote a set of backup scripts (thankfully now lost) that were over 10000 lines of sh, with embedded awk and sed. It maintained a tape database, etc. It was truly insane to debug. Anything more than about 300 lines ends up either as a set of small, easily maintained scripts (and one script that ties them together) or as a Perl or Python (depending on mood and how much of the work is raw text processing -- regex as a language intrinsic is a perl bonus.)

      --
      -30-
    5. Re:Shell scripting is deprecated by __past__ · · Score: 2, Informative
      There are several reasons:

      • Every Posix-compliant system has /bin/sh, but not neccessarily Python or any other interpreter or compiler. Which is the reason why Python comes with a ~20000-line configure script written in sh, not a python-based one even if it probably would be nicer.
      • It is the same language you use in an interactive shell. Once you figured out how to do stuff manually, you just have to put the commands you typed in a file together with a shebang line, and there is your script. Knowing shell scripting also helps when working in interactive mode, a loop or case/esac is also useful in one-liners.
      • It is generally faster to start a shell than another interpreter (although bash has almost fixed that, so this is not so much of an issue on GNU systems). If you have lots of small scripts, that matters (think init, for example).
      • You can source shell scripts, hence you can write a shell script that modifies the environment of your interactive session. You cannot do that with any other language.
      On the other hand, nobody proposes to write something like Zope in sh. Both Shell and higher-level languages have their uses, as have lower-level languages like C or assembly. The good programmer/admin is the one who can use more than one tool productively, and knows when to use which.
    6. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      I'm a perl programmer and yet I still find some things easier in shell such as archiving log files and searching through logs. In my experience there haven't been any more bugs/maintenance problems with 30 line shell scripts compared to 30 line perl scripts. I would disagree that shell is unstructured, it just has a different structure.

      The alternative scripting languages all have quite an overhead. I recently met a data warehouse contractor that preferred grep, awk and sed to perl because it was much faster and could get heaps of data processed in a small maintenance window.

      Also, the more you program in shell the better you get on the command line -- I am peforming wonders compared to a year ago. I've found that it makes my perl cleaner/better too.

      Personally, I go for the most basic Bourne shell features. It has a wonder and an elegance all of its own and is more than enough for most admin tasks. Shell is the glue that sticks the Unix environment together. You can't fully appreciate one without the other.

    7. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      What's the point in writing scripts in sh anyway? These days you can use more powerful and less fragile languages like Python. Shells have crappy error handling, complex escaping rules and generally they create more problems than they solve.

      What exactly is more powerful and less fragile about Python in comparison to a sh script? Programming languages are for writing programs to do things, sh scripts are for tying things together in an automated way. Often I find myself doing something more than once as a system admin. When I need to grep out things from a set of log files (assuming the files are not TOO large) I'll write a very quick shell script which gets placed in cron across various machines. For any tasks which are automated, sh scripts are quick and dirty ways to accomplish your goals in simple ways. I for one, do not wish to install Python on every damn Unix box I work on. Python is a nightmare to do nearly anything complex with for me. It requires way too many dependencies, is less reliable than good old "${SHELL}", and typically requires more overhead from my CPU and memory. No thanks, I'll stick with my 15 - 30 line shell scripts.

      Contrary to your opinion, shell scripts are easy to understand, well documented, and do not just break because you edited it (at least not any more than a program which you edited).

      Moderators: reply instead of modding down. Tell us why someone should prefer a crippled language when more advanced (and still equally easy to use) technology still has uses. History alone doesn't warrant it.

      I did both; have a Happy New Year, troll.

    8. Re:Shell scripting is deprecated by ultrabot · · Score: 1

      For one thing, launching processes or manipulating the file system (which is the only reason for a scripting language) is going to be much more verbose in Python.

      os.system("mycommand a.txt")

      Python will make you do incredibly stupid and redundant things like open files.

      How? Could you elaborate? You don't need to do anything you don't need with shell scripts.

      Secondly, injecting a filter between pipes in Python means either reading in the input entirely (waste of memory), or reading it piecemeal (verbose and unnecessary). With the shell, you inject a sub-process.

      os.system() allows you to execute full pipelines. I don't see what's the problem. You slurp in the output when you need to do something more advanced that can't be done by piping it to a pre-existing command.

      --
      Save your wrists today - switch to Dvorak
    9. Re:Shell scripting is deprecated by ultrabot · · Score: 1

      The shell is universally available. On some low-end systems (yes they still exist), Python and even Perl might not be installed.

      Yes, of course. Yet most of the scripts that sysadmins write are for normal systems with no such limitations.

      I'm not saying shell scripts have no purpose. I'm saying that in 95% of of the cases they are used a more structured solution would have been more appropriate.

      --
      Save your wrists today - switch to Dvorak
    10. Re:Shell scripting is deprecated by ultrabot · · Score: 1

      . In my experience there haven't been any more bugs/maintenance problems with 30 line shell scripts compared to 30 line perl scripts.

      I think that says more about Perl than shell scripts :-).

      --
      Save your wrists today - switch to Dvorak
    11. Re:Shell scripting is deprecated by Ars-Fartsica · · Score: 1
      Every Posix-compliant system has /bin/sh, but not neccessarily Python or any other interpreter or compiler.

      Name three major modern unices that does not include a decent scripting language by default. Perl and Python typically do show up in most self-respecting distros or are trivially available as precompiled packages.

      It is the same language you use in an interactive shell

      This is basically the "legacy" argument. You can use perl or python as interactive shells, there are tools to aid in this.

      It is generally faster to start a shell than another interpreter

      When all else fails, cite efficiency. I would ask you to provide one useful example where avoiding the startup time of perl has been a requirement for getting a job done.

      You can source shell scripts, hence you can write a shell script that modifies the environment of your interactive session. You cannot do that with any other language.

      This is categorically false. Sorry.

    12. Re:Shell scripting is deprecated by Ars-Fartsica · · Score: 1
      What exactly is more powerful and less fragile about Python in comparison to a sh script?

      Do you have an interactive debugger for sh? Thought not. Do you have language-level features for dumping and evaluating data structures in sh at run-time as inspectable structures? Thought not.

    13. Re:Shell scripting is deprecated by ultrabot · · Score: 1

      Which is the reason why Python comes with a ~20000-line configure script written in sh,

      Techically it's not 'written', it's an autoconf script.

      Knowing shell scripting also helps when working in interactive mode, a loop or case/esac is also useful in one-liners.

      This is true. Especially for loop comes in handy in interactive sessions.

      Knowing shell scripts is good, even necessary for sysadmins. Writing shell scripts is what should be discouraged.

      You can source shell scripts, hence you can write a shell script that modifies the environment of your interactive session. You cannot do that with any other language.

      Right. This is one of the defendable reasons for using shell scripts. The other one is "shorcut"-like functionality, i.e. using the script as an alias for a program w/ some arguments, perhaps changing the values of environment variables beforehand.

      --
      Save your wrists today - switch to Dvorak
    14. Re:Shell scripting is deprecated by ultrabot · · Score: 2, Interesting

      What exactly is more powerful and less fragile about Python in comparison to a sh script?

      If you are serious, you need to freshen up your computing skills a little bit. Shell scripts tend to fail in unpredictable ways, often with no clue what went wrong. Python script raises an exception that immediately tells where the problem is.

      Programming languages are for writing programs to do things, sh scripts are for tying things together in an automated way.

      You don't realize that things have changed from the time sh was developed. Better languages for the job exist now. Some of us can recognize superior technology - others repeat obsolete tautologies like mantras, with zero understanding of technological realities.

      Python is a nightmare to do nearly anything complex with for me.

      I'm not sure what that sentence means.

      It requires way too many dependencies, is less reliable than good old "${SHELL}", and typically requires more overhead from my CPU and memory.

      I'm not sure what kind of boxen you work with, but they certainly sound pretty broken and underpowered. Buy some p5, they should go for pretty low prices these days and have enough power to run these "heavy" tools.

      Happy New Year, troll.

      I think this underlines your mentality. Mod down and flame, instead of sticking to technical issues. The technical points you present sound pretty childish to me, and showcase a profound lack of understanding of the issues involved w/ complex systems. You should really catch up w/ the times, or be buried w/ the obsolete Unix boxen you currently maintain.

      BTW, if I notice something postworthy I post w/ my real name and skip moderation. Disagreeing with someone doesn't mean it's a troll.

      --
      Save your wrists today - switch to Dvorak
    15. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      ...

      cat somescript.sh | sh -x

    16. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      I knew a guy who wrote a _multithreaded_ front end to a backup program to backup live databases and fully utilize the tapes available in Korn shell.
      I had never thought of writing anything multithreaded in ksh.
      Do you work at a telecom?

    17. Re:Shell scripting is deprecated by halosfan · · Score: 2, Informative
      Personally, I like Python more than other general-purpose programming languages, and I keep a copy of the Python interpreter running in an xterm on my desktop at all times. Python is no doubt a very clean (yet expressive) programming language, and it also has an enormous standard library. All of that makes it a nice general-purpose programming language. That being said, Python is not an adequate replacement for Shell as a tool for (to quote the original poster) "tying things together in an automated way" nor is it an adequate replacement for Shell as a lanugage for interactive terminal sessions. For one,
      ls
      is shorter than
      import os
      os.system("ls")
      For two, believe it or not, outside of Linux, Python doesn't necessarily come with a Unix system by default, and no, where I work (a huge financial company), they won't let you compile an external package on a production host. Nor does Python come with the default OpenBSD installation that I run on an old Pentium which I happily use as a router/firewall at home. Granted, it's not a big deal to install Python on OpenBSD, but really, it takes more time and probably effort than piping find to xargs, and that's about the most advanced "program" that I ever write on that OpenBSD machine.

      To summarize, I believe that these two reasons (less verbose and always available) make shell a very viable scripting tool even today, in the presence of Python and Perl. And no, a shell script is not necessarily a mess when written by a good developer, just as Python code is not necessarily all clean and readable when written by a moron.

      --
      My only problem with Microsoft is the severity of bugs in their software.
    18. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      It requires way too many dependencies, is less reliable than good old "${SHELL}", and typically requires more overhead from my CPU and memory.

      I'm not sure what kind of boxen you work with, but they certainly sound pretty broken and underpowered. Buy some p5, they should go for pretty low prices these days and have enough power to run these "heavy" tools.


      I'm not sure what kind of OS maintinance you've done lately, but I'd like to see you mount /usr using python.

    19. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0
      The problem is that os.system() is cumbersome. You have to do a check to see what platform you're on (Windows returns a simple return value; Unix returns a tuple). On the shell I just do && or ||. On Python I have to write a wrapper function just to make things usable.

      The thing I was talking about with injecting sub-shells, is that in the shell I can do stuff like: prog1 | { shell code } | prog2 | { maybe if statements and for loops } | prog3 etc. In Python, I would either have to fork explicitly (yuck), or read in from the input piecemeal, and then write my translation on the output piecemeal (double-yuck). There is no straight-forward Python equivalent of { }.

    20. Re:Shell scripting is deprecated by Valar · · Score: 1

      import os
      os.system("mount /usr")

      i'm not even a python user and i know you can do that :)

    21. Re:Shell scripting is deprecated by ultrabot · · Score: 1

      You have to do a check to see what platform you're on

      Well, the situation is not buch better with shell scripts on windows - cygwin just doesn't work like it should.

      On Python I have to write a wrapper function just to make things usable.

      I always have a wrapper fn for os.system. Several, in fact. Typically I print out the command and then execute it. Sometimes w/ logging, sometimes w/o.

      In Python, I would either have to fork explicitly (yuck), or read in from the input piecemeal, and then write my translation on the output piecemeal (double-yuck). There is no straight-forward Python equivalent of { }.

      Have you checked out "pipes" module, by any chance?

      --
      Save your wrists today - switch to Dvorak
    22. Re:Shell scripting is deprecated by Ars-Fartsica · · Score: 1
      cat somescript.sh | sh -x

      What you are describing is a syntax check, not a debugger.

    23. Re:Shell scripting is deprecated by IM6100 · · Score: 1

      The irony that I think you may have missed is that you just used the binary /usr/local/bin/python (or /usr/bin/python on some installs, I suppose) to mount /usr.

      --
      A Good Intro to NetBS
    24. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      > If you are serious, you need to freshen up your
      > computing skills a little bit. Shell scripts
      > tend to fail in unpredictable ways, often with
      > no clue what went wrong.

      Not if you know what you are doing...

    25. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      Surprise, surprise, os.system() invokes--get this--the shell. Quite frankly, there's no reason why Python should reimplement what the shell already does quite well (unless it wants to add additional functionality Perl-style, which the os.system() API does not do).

      Also, how is os.system() supposed to be less verbose? And Python isn't designed primarily as a process control language, which makes things trickier than in a shell (have you ever done job control in Python)?

      None of this is to knock Python; it's a great language if you want to mix it up with C-based subroutines, I suppose (I personally think other scripting languages are easier to use/more powerful/etc.). However, refusing to use the shell scripting option is precluding the use of the right tool for the job.

    26. Re:Shell scripting is deprecated by ultrabot · · Score: 1

      Surprise, surprise, os.system() invokes--get this--the shell

      Of course it does. That's why you can do most of the stuff you use shell for in Python.

      I'm obviously not saying that the shell is evil incarnate that should be removed from the system. I'm saying that programming straight for it, instead of invoking it from Python, is futile.

      Also, how is os.system() supposed to be less verbose?

      We developers then to use these things called "functions" to make stuff less verbose. And nobody prevents you from doing

      x = os.system

      x("ls")

      And Python isn't designed primarily as a process control language, which makes things trickier than in a shell (have you ever done job control in Python)?

      Yes I have, if you mean the .pid file kind of stuff. Works like a charm. You fail to realize that language doesn't need to be "designed" for a particular task to excell in it, it happens automatically if the fundamental language design is good enough. You can do the rest with libraries.

      --
      Save your wrists today - switch to Dvorak
    27. Re:Shell scripting is deprecated by Anonymous Coward · · Score: 0

      Python...
      The Nazi school of programming again ?
      Perceived "quality" of a language has nothing to do whatsoever with the usability of a language.
      If this was the case, people would write ADA or Modula.
      However - they still write C, C++ or even COBOL.
      Shell scripts (like C or COBOL) are very good for certain jobs - very bad for others. The same applies to pet languages like Python.
      Sure - you COULD write a text editor in COBOL, or an accounting package in shell scripts. But a real programmer has learned that the most powerful or safest tool is not necessarily the best for the job at hand.

    28. Re:Shell scripting is deprecated by Wolfrider · · Score: 1

      --Geez, you and this Ultrabot troll are getting on my nerves already. He's already made my enemy list, and you're not far behind.

      --Who the hell needs an interactive debugger for SHELL SCRIPTS?! The reason nobody's written one is because they're NOT NEEDED!

      --If I want to "debug" a script, I just do ' set -o xtrace ' and/or ' DEBUGG=1 ;; if $DEBUGG echo ... ' stuff where I need to see what's going on.

      --Climb down off the high horses guys, shell scripts work fine where Python, et al (not to mention an interactive debugger -- sheesh! Ars-Fartsica $crack-pipe!) would be complete overkill.

      --
      .
      == WolfriderV6 == I'm willing to admit that *I just might* be wrong... Are you??
    29. Re:Shell scripting is deprecated by Wolfrider · · Score: 1

      (pounds sand in frustration)

      --Do you even REALIZE that os.system USES THE SHELL? You don't NEED python for that command... And as someone else pointed out, if /usr isn't mounted yet PYTHON ISN'T EVEN AVAILABLE YET!!!

      (scream, crash, sob)

      --
      .
      == WolfriderV6 == I'm willing to admit that *I just might* be wrong... Are you??
  34. Ah yes, the words of the Anonymous Coward... by Saeed+al-Sahaf · · Score: 1

    But apparently, you don't believe your own words enough to use your actual Slashdot account. This is the result of small testicals, but if you see a doctor, you may be able to get help.

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
  35. But /bin/sh _is_ installed by fizbin · · Score: 2, Interesting

    And, after all, the article said that the book focused on /bin/sh, not bash.

    And every unix system has some sort of /bin/sh. That's why startup scripts are written in /bin/sh - because it's always there.

  36. Not such a great option these days by imnoteddy · · Score: 2, Interesting
    I've done shell scripts for over two decades now. Did a one liner two days ago that checks on my bus and uses Mac OS X text to speech to tell my whether the bus is on time. It's amazing sometimes what you can do piping stuff through grep, awk, sed and so on.

    But these days as soon as I need a conditional or a loop I start thinking about doing the task in Perl or Python. These languages are so much easier to read and let you fork a process if you need to dip down into the shell.

    --
    No electrons were harmed creating this post, though some may have been subjected to electrical and/or magnetic fields.
    1. Re:Not such a great option these days by Anonymous Coward · · Score: 0

      Perl easier to read than ksh or bash? What
      planet are you from my friend?

  37. Ah yes, the words of a fanboy... by Anonymous Coward · · Score: 0

    Why do you assume I have an account in the first place? Slashdot does not require one to post. Second, you may want to see a mental health professional if you associate other people's scripting language preferences with their testicles (and you assume I'm male to boot which, granted, on this site is usually a given but still...)

  38. Re:wtf is up with this RACISM? by Anonymous Coward · · Score: 0

    I find it offensive. You may find it sarcastic, but it is still inappropriate, rude, and insulting. Cowboy Neal should change it, at least put a couple of **'s in there. We would still know who he is talking about, and it would be much more civilized.

    I find your taking offense at his comment offensive. Now please go and change your standards to suit my fragile ego as you expect me to do for yours. While you're at it, please take a poll of everybody's standards of offense and modify your speech and behavior appropriately so that you will cause no offense to anyone. That way, society will be much more civilized when you can no longer do or say anything, right?

  39. Re:wtf is up with this RACISM? by Anonymous Coward · · Score: 0

    Unless it's racism against Jews or whites, then it seems to be perfectly acceptable, even encouraged.

  40. also find, for/while loops, and $(( syntax by Ayanami+Rei · · Score: 1

    $(( is valuable in inner loops when spawning eval repeatedly can slow down a scan of files in a list, etc. etc.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  41. Shouldn't be "Troll", should be "Redundant" by Anonymous Coward · · Score: 0

    It should be modded "Redundant".

    Everyone here already knows that Malda hasn't changed his underwear in 25 years.

  42. Another good book by rsmith · · Score: 2, Informative

    And free as in beer:

    Advanced Bash-Scripting Guide

    --
    Never ascribe to malice that which is adequately explained by incompetence.
  43. php by Anonymous Coward · · Score: 0

    What is wrong with using php as shell script? I have for windows and linux, and it makes life easier (socket programming, db interface, etc). If someone can point out the errors of my way, I am willing to listen.

    My opinion is perl is ugly, haven't tried Python yet though...

  44. bash is not Bourne by Anonymous Coward · · Score: 0

    I'm sure I'm going to end up being the fiftieth person to note this, but still...bash is not Bourne. bash is the Bourne Again shell. sh is the Bourne shell. bash has many extensions that are not present in the Bourne shell.

    One of my pet peeves is people who'll start a script with #!/bin/sh and then go on to use bash-specific syntax. That is just plain wrong; if you are going to use bash syntax, use #!/usr/bin/bash (or point to the actual location of bash on your system). In many cases /bin/sh does just point to the bash shell, but you can't count on that being the case.

    1. Re:bash is not Bourne by theendlessnow · · Score: 1
      $ echo "But bash is a superset of Bourne shell!"

      Well.. almost anyway...

    2. Re:bash is not Bourne by dotgain · · Score: 1

      Yeah but bash can tell when it was started as "sh" and run in compatibility mode, to roughly quote another poster somewhere in this thread - Don't mod me up.

  45. Yes, and... by Vaevictis666 · · Score: 1

    if I recall correctly, the plan for Longhorn is to be able to do ANYTHING from commandline. If it can be tweaked in a GUI, there's a shell command that will do the same thing.

    1. Re:Yes, and... by JPriest · · Score: 1

      What information do you have to back this up?

      --
      Saying Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders.
    2. Re:Yes, and... by Anonymous Coward · · Score: 0

      >the plan for Longhorn is to be able to do ANYTHING
      >from commandline. If it can be tweaked in a GUI,
      >there's a shell command that will do the same
      >thing.

      So what you are saying is that they want to be able to do what you could do in linux 11 years ago?

    3. Re:Yes, and... by Not+The+Real+Me · · Score: 1

      I've heard about the M$ korn shell that lets you do all sorts of stuff without going into the GUI.

      My guess, it'll need the 14+ meg .NET runtime to work. It may even be something like running gwbasic from the DOS 3.31 days except much BIGGER.

      Then again, Visual Basic's biggest flaw was requiring a GUI/forms for everying. At least Visual C++ let you create console apps.

  46. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  47. Please kill sh and its children by Ars-Fartsica · · Score: 0, Troll
    This book is irrelevant because anyone sane already knows the futility in trying to do anything non-trivial in sh.

    sh and make are two utilities that frankly would never be succesfully introduced today. We use and accept them because of their incredible legacy presence.

    There is no reason why I cannot have a shell language that has all of the functionality and features of python or perl. Yes there are projects to use these languages as true interactive shells but the continued use of sh keeps them from getting steam.

    Killing sh and make would be two great steps forward for modernizing unix.

    1. Re:Please kill sh and its children by dmadole · · Score: 1

      This book is irrelevant because anyone sane already knows the futility in trying to do anything non-trivial in sh.

      I disagree and refer you to an example of a significant shell application that is complex and useful: Enhanced Network Scanjet 5 (I'm the author).

      This is about 2,400 lines of Bourne shell (runs under BSD sh or Bash) that reimplements the HP Network Scanjet 5 functionality, with many improvements, particularly the fact that is is completely standalone.

      This application was originally written in about five working days, and I firmly beleive that it would have been just about impossible in that time in any other language but shell. The ease with which other utilities such as Sane and Ghostscript were integrated was a huge feature of sh.

    2. Re:Please kill sh and its children by Ars-Fartsica · · Score: 1
      This application was originally written in about five working days, and I firmly beleive that it would have been just about impossible in that time in any other language but shell.

      For fun I downloaded your script. You are truly a glutton for punishment. 80% of this code could have been more sanely expressed in perl. Your script demonstrates extreme proficiency in sh scripting (hats off to you) but in no way invalidates the well-established idea that perl or python are superior for long scripts. I suspect this program would have been coded in half the number of lines using perl in particular, just in syntactic clarity and expressiveness without knowing anything about the actual hardware you are dealing with.

    3. Re:Please kill sh and its children by Anonymous Coward · · Score: 0

      > There is no reason why I cannot have a shell
      > language that has all of the functionality and
      > features of python or perl...

      You're right! It's called ksh93. In addition,
      you'll find that you can accomplish in ksh93
      what you can in Perl and Python with fewer
      lines of code.

  48. man, I love shell scripts by gse · · Score: 1
    It's interesting that the reviewer describes shell scripting as "not easy to pick up"... I've always found shell scripts simple and elegant. You can describe the way they work, at a high level, in about 2 sentences. Of course some of the tools themselves are pretty arcane (like awk), which is why we reach for perl and friends to do more sophisticated things in one shell "step".

    The other day I wrote a little utility to track referrers to my websites. I wrote the main chunk in perl. But the part that actually drives the whole process -- that sifts through config directories, calls child scripts, sends email... right back to bash. It's just so damn easy. Or maybe that's just my distaste for perl talking.

    --
    wordclock records :: flailing since 2000
  49. Moderators are clearly not sysadmins by Ars-Fartsica · · Score: 1
    The poster is correct - sh is completely useless for anything non-trivial.

    I typically discard shell for anything more complex than a while/do sh loop. For anything moderately complex, sh is baroque, syntactically retarded, and feature-deficient.

    1. Re:Moderators are clearly not sysadmins by Anonymous Coward · · Score: 0

      You obviously don't know a damned thing about
      ksh93 or bash do you? You've *never* seriously
      studied them or you wouldn't make such an
      ignorant statement.

    2. Re:Moderators are clearly not sysadmins by Wolfrider · · Score: 1

      'Tis a rare day on /. when you have to agree with an AC over a logged-in, relatively-low-numbered user that Lacks Clue. :(

      --
      .
      == WolfriderV6 == I'm willing to admit that *I just might* be wrong... Are you??
  50. BZZZT. Name one distro that doesn't include them by Ars-Fartsica · · Score: 1

    Please, tell me what distro does not include perl or python practically by default. This is a silly argument that was irrelevant about four years ago.

  51. I also worked on his book... by Ayanami+Rei · · Score: 1

    ...In my imaginary Slashdot fantasy land. We should do lunch sometime.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  52. Classic "young programmer" misconceptions by Ars-Fartsica · · Score: 1
    To presume that efficiency concerns should outweigh maintainability and portability in scripts is a classic novice error. More shameful if you have actually been going at it for a few years.

    If memory concerns are truly an issue, you are not going to get relief by simply switching environments. You probably need to rethink and redesign.

  53. Mother of All Shells by Bilbo · · Score: 1
    The Borne Shell is what I would call, The Mother of All Shells. Other shells (ksh, bash) are usually a superset of /bin/sh. Csh (and its ilk) is another beast entirely, but I never really considered it a REAL shell for doing programming in.

    Basically, if you have a *NIX like system, you are pretty much guaranteed to have a /bin/sh, and it will always work the same. Bash is common, but not universal. Ksh is proprietary, though there are open source versions (pdksh), but you won't find it everywhere. Csh is an abomination. Other shells are interesting and useful, but you'll never know if they are on any given system, or if they will run the same.

    If you want a script that will run the same everywhere, then use /bin/sh.

    (Of course, this isn't even getting into differences between "awk", "nawk", "gawk" and all the other tools and their various incarnations that you end up using in shell scripts, but at least you can have some hope that the underlying shell will be predictable.)

    --
    Your Servant, B. Baggins
  54. Aaaauuugh! NCR! by ThesQuid · · Score: 2, Funny

    Please don't mention NCR! It's been almost 3 years since I quit as a field engineer and I still have nightmares...

  55. Why? What does speed have to do with it by SmallFurryCreature · · Score: 1
    A shell script for me automates things I could do by hand. For instance to start apache properly I need to do a number of things. Check if I want to start or restart or reload config. Also if apache is already running and if not why not. Then to see if my command is actually carried out. Etc etc etc

    All of these I can do by hand and on machines where the scripts are borked I do. I then replace the IF WHEN WHILE bits of the scripting language with my brain. In fact that is how I write scripts. I write down into code what I have been doing each time.

    So speed of cpu is meaningless. It is all done to help lazy sysadmins.

    You might mean, because cpu is more powerfull can't we use other languages. Well yes. There is nothing really stopping you from replacing a lot of shell scripts with say perl. EXCEPT. Perl may not always be there or working. You need something simple and lowlevel for simple and lowlevel tasks. I don't see this changing. Hell MS is talking of adding stuff like this to longhorn.

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

  56. HPUX by vileMuncher · · Score: 0

    When I went to work at HP I was amazed to find the default shell of HPUX to be Ksh (Korn), sort of a Children of the Korn Environment?

    Really, there are people at HP in Boise who have thousands of hours of highly useful Ksh Scripts for doing everything from test automation to you name it.

    The young folk coming in seem less then enthusiastic about learning Shell Scripting, to bad.

    1. Re:HPUX by calidoscope · · Score: 1
      When I went to work at HP I was amazed to find the default shell of HPUX to be Ksh (Korn), sort of a Children of the Korn Environment?

      FWIW, the Korn shell was available before BASH and came with most commercial unices from about 1990 on. Korn's intent was to have a shell that was useful for programming as the original Bourne shell and was as nice for interactive use as the C shell.

      BASH is common on Linux as the source code for KSH was not widely available until relatively recently. The other problem is that most unices come with an old version of ksh (1988).

      --
      A Shadeless room is a brighter room.
  57. True, but how long? by Martigan80 · · Score: 1

    language has not changed noticeably in twenty five years and should not change in another twenty five

    Is this a good thing? I mean don't we sometimes have to abandon the ideas of old in order to progress? How has English evolved over the past 50 years? Besides the branch of American English and the ones the UK speaks and writes. Maybe not much but how about 300 years? As technology progresses further than a Moore breaking speed should the language not evolve as well?

    I agree that Unix language is solid and has been around for a while, but should we choose the permanent language based on technology first conceived 25 years ago?

    --
    This SIG pulled due to lack of funding. (This damn war is costing too much!)
    1. Re:True, but how long? by mariox19 · · Score: 1

      Just wait 2 u c how english sgonna evolve in da next 50!

      --

      quiquid id est, timeo puellas et oscula dantes.

    2. Re:True, but how long? by Anonymous Coward · · Score: 0
      Sharks haven't evolved much in the past 20 million years either. Nor have horseshoe crabs.

      You can do bewilderingly much with something like zsh these days. If you can come up with something better, go for it.

      As for me, if zsh can't do it, python will. And if that won't, there's java. And if that won't do it, there's C++/C. And if that won't do it, well, sorry but I got tired of assembler 20 years ago so a younger geek will have to handle it.

    3. Re:True, but how long? by Anonymous Coward · · Score: 0

      You could say the same thing about C. In general, basic infrastructure like shell scripting, etc. shouldn't evolve. Instead, if you want to try something newer/better (Perl, Java), you should create something new; but the cost to maintain that backward compatibility doesn't justify throwing out the old solution. Right tool for the job.

  58. BZZZT. You are a newbie by rhizome · · Score: 1

    I don't know what "practically by default" is supposed to mean, but I'll tell you what Unices (even beyond your Linux "distros") don't have Perl or Python: the ones where /usr is unavailable at the time you need to do something.

    --
    When I was a kid, we only had one Darth.
    1. Re:BZZZT. You are a newbie by Ars-Fartsica · · Score: 1
      the ones where /usr is unavailable at the time you need to do something.

      I'M A NEWBIE??? Gee - like i couldn't compile perl to reside in /bin??????

      Make it your goal in 2004 to understand the --prefix feature of the gnu build toolset. And to think you are calling me a newbie.

    2. Re:BZZZT. You are a newbie by Anonymous Coward · · Score: 0

      You're a newbie. It completely violates the logic of the Unix file system to put perl in /bin (BTW, you could just copy the binary there, or use a symlink, or put in a shell script which executes perl in another directory, or fiddle with your environment variables).

      The basic point is that something as massive as Perl, which relies on shared libraries and a massive number of modules, isn't something that you want to run when your system has blown a gasket. Of course, I suppose your system has never, ever needed to run from /bin.

  59. Re:Can't we all just get along? by Lord+Bitman · · Score: 1

    Reading through this thread, I am wondering- am I the only one who uses shell scripts, then breaks into perl whenever something more complicated is needed?
    Sure, you can do everything with awk and sed if you want to, but having perl -e in the middle of all those pipes is not a sin, and it makes otherwise tedious proccesses go by quickly.

    --
    -- 'The' Lord and Master Bitman On High, Master Of All
  60. Re:wtf is up with this RACISM? by Webmonger · · Score: 1

    Get black people to stop using that word, then we'll talk. The notion that only certain people can use that word is racist too.

  61. Pascal by tobyp · · Score: 0

    I think Niklaus Wirth would be interested to hear that Bill Joy was the creator of Pascal...

    I'm off to the pub. Happy New Year all!

    Toby Poynder
    London, UK

  62. Advanced Bash-Scripting Guide by Arkahn · · Score: 1

    Another (free) resource is the very readable, very thorough Advanced Bash-Scripting Guide [http://www.tldp.org/LDP/abs/html/]. Mendel Cooper has done an excellent job with this project. If a person wished to learn more about Bash, I would direct them here *first*.

  63. Re:Can't we all just get along? by thegameiam · · Score: 1

    Personally, I prefer shell scripts due to their ease and speed - most of my scripting is of the "I have N tons of data, find some piece of information & correlation" type. If I'm automating tasks, I'll use a shell script to tie together a series of perl & expect scripts...

    --
    Need Geek Rock? Try The Franchise!
  64. Okay by brokeninside · · Score: 2, Informative
    Tell me which flavors of Unix that ship with both Perl and Python as part of the default install. The new Solaris boxes at my employer do have perl installed, but only as a site specific addition. They do not have python installed except for the webservers where it was specifically installed for certain projects that require it.

    Here's a clue: there's more to *nix than Linux.

    1. Re:Okay by Anonymous Coward · · Score: 0

      yes but it is well known that solaris is totally useless from a default install, and to add insult to injury the package manager blows.

    2. Re:Okay by robhancock · · Score: 1

      Well, as far as that's concerned, that's just one more step that would be necessary for a Solaris machine to be usable. HP-UX is about the same; that's why whenever I log into one of those machines I end up cursing at the fact that the command completion doesn't work right, all too often the backspace key doesn't work properly without more setup, the only editors installed are either the bloated emacs or a version of vi that seems to be from the 1970s, etc.

  65. What do you mean by default? by brokeninside · · Score: 1
    Name three major modern unices that does not include a decent scripting language by default. Perl and Python typically do show up in most self-respecting distros or are trivially available as precompiled packages.
    You're second sentence is entirely irrelevant to the first. Being available in a software distribution or being trivially available as precompiled packages is not the same as being installed by default.

    But the question really is, which flavors of Unix have both Perl and Python installed by default. Once can count on having the Bourne shell (or something compatible) on virtually any Unix installation. If one is to target Perl or Python, one cannot count on it being there.

    1. Re:What do you mean by default? by Ars-Fartsica · · Score: 1

      If one is to target Perl or Python, one cannot count on it being there.Well seeing as the target system for most scripts is YOUR OWN COMPUTER I think you should be able to handle apt-get install python.

    2. Re:What do you mean by default? by IM6100 · · Score: 1

      Maybe that's the target for all of YOUR scripts.

      Some of us live in the bigger world, i.e. with solaris boxes out there we need to do work on that we only have user accounts on.

      --
      A Good Intro to NetBS
    3. Re:What do you mean by default? by robhancock · · Score: 1

      Well, last Red Hat machine I installed using the default "workstation" settings has both of those installed. It could be that some of the other installs (minimal, etc.) don't include them, but I certainly didn't specifically choose to install them.

      Unless you're being pedantic and don't consider Linux to be a flavor of UNIX(tm)..

  66. LOL! by virid · · Score: 1

    Windows NT scripting is "very functional" but Perl is bloat. Wow, funniest thing I've heard all year.

    --
    "The world only exists in your eyes. You can make it as big or as small as you want." - F Scott Fitzgerald
    1. Re:LOL! by rmdyer · · Score: 1

      That is NOT what I said. I said that scripting languages like Perl...are "bloated". In this manner as in most uses, the term "bloat" is relative. What I mean when I say bloat is totally dependent on startup time and memory usage. When you startup a shell, you will see that it starts up much faster and uses much less memory than Perl or Python. Am I wrong? I did NOT say that shell scripting was "as functional as" Perl.

      Your reaction however in my experience is typical of most Perl programmers. But here again, we have a language (Perl) that has been stretched beyond it's intended purposes. Why is Perl used for process control an management these days? It is because over time people get used to using a single language almost exclusively for the purposes of specialization. If you can't specialize, you will never be good at what you are doing. It's the "jack of all trades, master of none" syndrome. The people who became good at Perl decided to stretch the language into performing things that were originally outside of its character. This is where bloat and uglyness begins. I think it is actually better to use those languages and scripting techniques that fit the problem situation the best. In this case we are discussing shell scripting, which traditionally means process management and control, not parsing of text to generate reports.

      I suppose it would be nice to generate a gaussian map of languages vs. realms of use. This might make it easier to decide which ones would be better suited to a specific task.

      I don't think Perl or Python are "bloated" for their intended purposes. I could change my sentence to read "...shell scripting is a bit too thin to be used for anything beyond process management and control. For the actual development of applications you should use the more streamlined and efficient Perl, or Python". But applications are not what we are talking about doing here. We are talking about shell scripting, which in my view, Perl is not suited for...although you can. This is much like using VB instead of command shell. Why would I write a full fledged VB application just to startup or stop processes?

      If you think you've got a language that is best for everything, then I've got a bridge to sell you.

  67. Does it cover arcane features like fd handling? by Anonymous Coward · · Score: 0
    There are some relatively undocumented areas of the Bourne shell which I'd like to see covered:

    1) opening files for reading and writing by file descriptor
    2) merging and splitting file descriptors
    3) field separators, quoting, and globing
    4) handling whitespace and empty variables in tests without getting syntax errors
    5) signal handling
    6) semantics of subprocesses (when do variable or env variable changes become visible, if ever, etc.)
    Why is Slashdot centering the text in my post?

  68. one word by ChristTrekker · · Score: 1

    NetBSD.

    1. Re:one word by Anonymous Coward · · Score: 0

      okay, now name three users of netbsd.

  69. Shell procedures -- not shell scripts by geoswan · · Score: 1

    Steve Bourne calls them shell procedures not shell scripts. I figure since he created the shell named after him, he should know. So I call them that too.

  70. oops sorry by Anonymous Coward · · Score: 0

    I was thinking of ( ), not { }. ( ) opens a subshell; { } runs in the current shell (which has its own interesting effects).

  71. shell scripts need more than just the shell by jvs · · Score: 1

    All the comments about how powerfull shell scripting is, miss an important point:

    The vast majority of shell scripts rely on other commands to do alot of the work. For example, how many shell scripts use awk, sed, find, cut, head, tail and so on. Without all the "external" commands the shell is much less useful.

    In addition, there is considerable overhead due to the fork/exec of these external commands.

    With languages like perl/python/ruby you may have to actually write a little more but it all executes within a single process.

    1. Re:shell scripts need more than just the shell by Anonymous Coward · · Score: 0

      What you say may be true for the Bourne shell
      or csh but not for Korn shell (ksh93). Korn
      shell was written so that the dependency on
      these tools could be eliminated for most cases.
      When I write ksh scripts I almost never need to
      call awk, sed, tail, etc.; On the other hand, if
      there is some reasone that I need to... I can,
      and do. And your comment about calling external
      programs brings up an important point about the
      shell. The ability to build upon and use tools
      that others have already provided. This was one
      of the fundemental concepts present in early
      Unix and a driving philosophical force. The
      shell is as important today as ever and all
      programmers and sysadmins should know it inside
      and out.

    2. Re:shell scripts need more than just the shell by Anonymous Coward · · Score: 0

      Also, fork/exec is cheap, and it's a great way to keep programs from mucking up each other's internals.

  72. bloated? by sir_lichtkind · · Score: 0

    comm'on Perl is under 1MB. in the 90 that was'nt bloatet.

  73. how touching by segment · · Score: 1

    Here's a script for that nicely written post. Happy New Year!

    GET http://www.perfidious.org/award|\
    sed '1!G;h;$!d'|sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'|\
    write `whoami`

  74. simple bash-y tab completion question by what+the+dumple+is · · Score: 1

    Ok, I have a question. My ISP uses bash and when you tab complete stuff it automagically encloses it in double quotes. But when I tab complete on my own box it just does the old insert\ back\ slashes which is kind of lame.

    So, I figure it must be some sort of option I can change in bashrc or something but I don't know what needs to be changed or added for this to occur.

    1. Re:simple bash-y tab completion question by Anonymous Coward · · Score: 0

      Enclosing in double quotes doesn't always work, you know (double quotes still evaluate some strings). However, in bash I know you can start something with a quote (or double quote), and then use tab-complete and it'll use the quote/double quote instead of the
      \'s (so I imagine there's probably an option). However, they're equivalent, so I'm not sure what the point is.

  75. Re:BZZZT. Name one distro that doesn't include the by IM6100 · · Score: 1

    My Minix box doesn't have perl or python.

    No room for that kind of bloat. The entire install media set, including all source, fits on 9 floppies.

    --
    A Good Intro to NetBS
  76. found more reviews by Anonymous Coward · · Score: 0

    I found more reviews at verygeekybooks.com. Here is the link.

  77. LIAR. Good Amazon Link. by Anonymous Coward · · Score: 0

    A referral link, but definitely not a tubgirl link.

  78. Re:wtf is up with this RACISM? by twocents · · Score: 1

    I agree that racism is intolerable. However, my response was directed at a comment I read that implied that the blog was intentionally promoting racism.

    I read his blog entry as an illustration of how awful some posters are. While perhaps he could have worded it a bit better, it still sounded to me as if his blog implied that people who post racist comments are the lowest of the low, the people that "gotta piss in the pool".

  79. Your target for scripts is your own computer? by brokeninside · · Score: 1

    I guess that means that you've yet to have any sort of job in the IT industry.

  80. Re:Can't we all just get along? by Anonymous Coward · · Score: 0

    When I see someone who finds themselves
    constantly dipping into awk and sed when
    doing shell programming it tells me that
    they don't know much about shell programming.
    Go learn ksh93 inside and out and you won't
    have to do this. Same goes for people who
    think that the shell is "just" for tying
    together all those Perl and Python scripts.

  81. smartadmin a scripting example using dialog by stock · · Score: 1

    Maybe a good example of how shell scripting can be made to good use is smartadmin, which i wrote during a weekend :

    ftp://ftp.crashrecovery.org/pub/linux/smartadmin/

    smartadmin - Create/Edit/Remove a UNIX/Linux user and/or a Samba user.

    smartadmin was created out of sheer misgrief about total contra produc-
    tive effects of packages like webmin, requiring rediculous resources to
    perform basic user administration on a UNIX/Linux and Samba server. The
    requirements for smartadmin to act as remote admin is just a terminal
    client program which can handle ncurses/dialog menu's.

  82. Huh when did this happen :-D??? by Grizzlysmit · · Score: 1

    Now that we have languages such as Perl and Python, much of shell scripting has been forgotten.

    I for one still use shell scripts all the time, thats the reason I hate Csh/Tcsh and family their grammar is broken, scripting in them is fairly crappy, as I remember all too well. For some things shell scripts are just better, easier and more scalable, I use the right tool for the right job mostly, never use python it's no begin, {/end, { syntax sux majorly.
    --
    in my life God comes first.... but Linux is pretty high after that :-D
    Francis Smit
  83. Re:BZZZT. Name one distro that doesn't include the by Anonymous Coward · · Score: 0

    Perl and Python introduce possible security holes, as they have all sorts of modules and add-ons that might not be secure. The shell is well-understood, hasn't changed in decades, and (unlike Perl or Python) is a required part of any Unix system (although for the truly security conscious, you might want to ditch the shell as well if you can get away with it).

    Please, tell me what embedded distro includes perl or python practically by default. Always wanted a few extra scripting languages on a 4 MB ROM. Right.

  84. You're a rebel fella by Anonymous Coward · · Score: 0

    lol you are badass little fuckwit...your site is fucking retarded. How can't you be embarassed to live for God's sakes?
    ah well, maybe you'll be shot in a botched bank robbery or something...later fag

  85. My mantra by jjgm · · Score: 2, Insightful

    When the Junior Unix Sysadmin comes to me, as they do, and asks "what language should I write this tool in?", here is my decision sequence:

    • shell (with sed/awk/grep) for process management/job control and line-by-line text processing.
    • C for servers, time-sensitive applications, interfaces to syscalls.
    • Python or Ruby for complex system tools that benefit from an object model.
    • Perl for text mangling. I know; Perl can do anything, and often it's the fastest to write. But as the corollary has it: in Perl, there are too many ways to do it. I usually say that "Using Perl for any of the above is cheating," but what I actually mean is that since most of the perl I've seen produced by anyone below "Guru" status is sloppy, undisciplined, inconsistent and barely maintainable, I'd rather see the above languages used instead.
    • Java for the server-side of big business applications (i.e. Java is the new COBOL)
    • C++ when Java is too slow or memory hungry, or for client-side business apps (e.g. GUIs, office software, the recording backend for your particle accelerator)
    This list, in this order of preference, has stood me in good stead for years and leads to decisions that are almost always right.

    I never recommend TCL or expect, believing them obsoleted by python/ruby. LISP is only a good recommendation for emacs weenies, who live in their own wonderful world and never ask others anyway.

    Sorry, no, PHP doesn't qualify as a useful language in my book. I see it as an API the size of a planet driven by a syntax akin to a small, sick dog. Vade retro.

    - J

  86. Shell was right (sort of) by Ristretto · · Score: 1

    The shell-like scripting languages are actually a lot closer fit to their problem domain (managing programs, I/O, and files) than more recent scripting languages like Perl and Python. There are a number of reasons for their decline in popularity, but it is hard to argue that explicit management of files and their contents (open, close, iteration) is easier or better than piping and redirection. It is also possible to make shell-like languages both faster and safer than other scripting languages (this is work in progress - I hope to make a prototype release available soon). Although it may surprise many Slashdot readers to hear that bash is easily 10 times faster than Perl for many text processing tasks...

  87. complexity is in the eye of the beholder by Clover_Kicker · · Score: 1

    Once upon a time I had some nasty .BAT files that used AWK.EXE and SED.EXE for the heavy lifting. Explaining them to a coworker took a while, because he wasn't an awk or sed guy.

    WSH is complex, but nontrivial shell scripts are complex too, there's a lot of baggage involved.

    I'm an equal opportunity bigot: I hate all the common scripting choices. .BAT files are very limited, and annoying. VBscript/WSH syntax is verbose and annoying. Shell syntax is just plain fucked up and annoying.

    The above have their place, and I can write scripts in all of 'em, but I don't enjoy it.

    When possible I lean on awk/sed/Perl. The DJGPP AWK.EXE and SED.EXE has saved my bacon many times, and these days Perl runs nicely on Win32.

  88. Re:wtf is up with this RACISM? by Anonymous Coward · · Score: 0

    Ah, yes, the standard argument used by racists to defend the indefensible.

  89. Re:Can't we all just get along? by Lord+Bitman · · Score: 1

    except that awk and sed tend to be the same no matter what shell you're using

    --
    -- 'The' Lord and Master Bitman On High, Master Of All
  90. I count Linux as Unix by brokeninside · · Score: 1
    And I also think it safe to say that the default install of most Linux distributions enable virtually everything except the kitchen sink (and some do that!).

    But, I'm also pretty certain that this is a minority position. Most Unix boxes are purchased/leased for a specific purpose and the default install contains very little leaving the administrator to decide which programs to install. The fewer programs installed, the fewer possibilities there are for something to go wrong.

    I hold that this is a good thing because the administrator knows better if Perl (or Python) is needed and if so if Perl (or Python) needs to be a specific version or flavor or compiled with specific options and so on and so forth. It is best to keep the defaults to a minimum and assume that the adminstrator knows what to add on and what not to.

  91. Depends on what the box is to be used for by brokeninside · · Score: 1
    I can think of a good number of situations where Perl (or Python) should emphatically not be installed. I can also think of situations where a specific version of Perl (or Python) and no other ought to be installed. Because situations like these are not all that rare, it is best to not include Perl or Python in the default install and to allow system admins to choose which (if any) version of these tools get installed.

    Hence, your beef seems to me to be with sys admins that aren't providing the tools that the boxes they installed need for the users to get their work done. It doesn't really have anything to do with whether or not a given toolset is part of the default install.

    Although, I will also say that it royally pisses me off when the sys admin installs one of the newfangled versions of vi with all the bells and whistles turned on so that I have to edit some .rc file or the other to turn them off so that vi acts like vi. When I want syntax highlighting and autoindent, I'll use xemacs. Few things are more irritating than discovering pasting a sizeable chunk of code only to discover that vi is actually vim and autoindent is turned and all the indentation in twenty lines or so of code you just pasted gets funged because vim's autoindent sucks when the pasting lines already indented.

  92. Whatever by paul.dunne · · Score: 1

    Whatever. This book is no substitute for a close reading of The Unix Programming Environment -- if anyone knows what is, I'd love to hear about it.