Slashdot Mirror


From Bash To Z Shell

r3lody (Raymond Lodato) writes "Novice users and power users of *nix will enjoy reading From Bash to Z Shell: Conquering the Command line by Oliver Kiddle, Jerry Peek, and Peter Stephenson. In this moderate-sized book from Apress, the authors delve into both bash (the Bourne Again Shell) and zsh (Z Shell) to enable you to use them to their fullest advantage. Topics range from the simple editing of the command line to redefining key sequences, down into creating functions for editing and command-line completion. Some areas are covered in other books, but this one goes into some little-seen side streets and alleyways to show you the shortcuts to more efficient use of the shell." Read on for the rest of Lodato's review. From Bash to Z Shell: Conquering the Command Line author Oliver Kiddle, Jerry Peek, and Peter Stephenson pages 472 publisher Apress rating 9 reviewer Raymond Lodato (rlodato AT yahoo DOT com) ISBN 1590593766 summary An in-depth look at the functionality of bash and zsh.

A *nix-style shell is available on a number of platforms, so the authors chose not to limit themselves to just one, such as Linux. The techniques they discuss can be used in Unix, as well as under Windows using cygwin.

In case you're not overly well-versed in shell handling, the first part of the book does a pretty good job covering all of the things a typical user might want to do. Basic command editing, I/O redirection, jobs, processes, and some simple scripting are all covered. For many users, this is also as far as they would like to go. However, reading a little further yields treasure.

The next part delves into bash version 3.0 and zsh version 4.2, both freely available on the Internet. In addition to more sophisticated command line editing techniques, the authors also delve into the misty realms of re-binding keys. A great many users find themselves typing the same sequences over and over again. While sometimes a script makes sense to encapsulate these sequences, sometimes you want to simply enter some text and that's where a key binding makes sense. One example given in the book for zsh is bindkey -s '\C-xt' 'March 2004\eb' . After the binding, typing CTRL-x t puts the string 'March 2004' onto the command line, and moves the cursor under the '2' so you can insert the day of the month. That's a very simple example for a very powerful facility. A good chunk of chapter 4 is spent on showing how to make the most of bindkey (or its bash cousin 'bind').

The next few chapters cover common topics of prompt strings, file/directory globbing, and shell history. Then, significant press is given to the subject of pattern matching. Many people understand basic pattern matching and regular expressions, but From Bash to Z Shell goes into careful detail, with many examples from both bash and zsh, to contrast the (minor) differences between these two powerful shells. The next chapter discusses command line and file/directory name completion, a topic usually glossed over in other texts. Finally, job processing wraps up Part 2.

The third and final part of the book deals with extending the shell using variables, scripts, and functions. Here's where we get into the nitty-gritty. The first two chapters go over familiar territory: shell variables and shell programming. The chapter on programming is easy to follow, and I suggest you try the examples as you go to get the most out of it. The last two chapters focus on topics frequently overlooked: editor functions, and completion functions. Editor functions allow you (with bind[key]) to define new capabilities to use while editing the command line. This is where a true power user can shine, creating a suite of new functions to speed his/her use of zsh or bash. Completion functions work in defining new ways for the shell to complete a command, file name, or directory, based on a user-written function. Honestly, it's not something I would tend to use, but the capability is intriguing.

All in all, From Bash to Z Shell provides a frequent shell user with a plethora of new insights into customizing the bash and zsh shell programs to fit his/her tastes. The authors have filled a void in tackling the subject of customizing the shell rather than just simply using it. I would have liked to see more coverage of some of the more standard uses of the shells, just so the book could be a more complete reference, rather than the specialized one it is. Specialized or not, there is a lot offered here, and you couldn't go wrong getting this book.

You can purchase From Bash to Z Shell: Conquering the Command Line from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

214 comments

  1. Which one? by Anonymous Coward · · Score: 4, Funny

    Which shell has a better wallpaper? More options when I right-click?

    1. Re:Which one? by SIGALRM · · Score: 3, Funny
      #!/bin/bash

      source tfa
      [ "$?" -eq 0 ] && return 1
      --
      Sigs cause cancer.
    2. Re:Which one? by Anonymous Coward · · Score: 4, Funny

      My Bash console shell has a screenshot from Doom III as the wallpaper. At least it looks that way...

  2. Wouldn't it have been better... by jgerry · · Score: 4, Insightful

    Uh, wouldn't it have been cooler to actually go the extra mile with the whole A to Z metaphor and call the book "From Ash to Z Shell"? There is a shell called ash.

    1. Re:Wouldn't it have been better... by AKAImBatman · · Score: 3, Funny

      "From Ash to Z Shell"?

      Technically, that should be either "From ash to zsh" or "From A to Z Shell".

    2. Re:Wouldn't it have been better... by Anonymous Coward · · Score: 0

      Actually, it should have been:

      "From Almquist to Z Shell"

    3. Re:Wouldn't it have been better... by exley · · Score: 4, Insightful

      Well, considering that the focus appears to be just on bash and zsh, I'd say no. With that in mind, however, perhaps they could have spent more time choosing a more concise title.

    4. Re:Wouldn't it have been better... by AKAImBatman · · Score: 0

      "From Almquist to Z Shell"

      If that were true, then the original title would have been "From Bourne Again to Z Shell".

    5. Re:Wouldn't it have been better... by Len · · Score: 2, Informative
      or "From A to Z Shell".

      Technically that's not right either because ash is the Adventure Shell!

    6. Re:Wouldn't it have been better... by AKAImBatman · · Score: 2, Informative

      Ummm... no. That would be a different thing. Ash is the Almquist Shell, an open source replacement for /bin/sh (the bourne shell).

    7. Re:Wouldn't it have been better... by jondt · · Score: 3, Informative

      except, if you'd read the article, you would have noticed that the author only covers bash and zsh. Ash is given but a cursory glance.

    8. Re:Wouldn't it have been better... by Brandybuck · · Score: 3, Interesting

      Which is a shame because the world ends up with more bash-only and zsh-only scripts. As a user give me all the bash goodness you can, but as a scripter give me the lingua franca that is the vanilla bourne shell.

      I say this because I once spent months fixing hundreds of scripts in an embedded system after the OS vendor upgraded from bash-1.x to bash-2.x. If you don't need the extras that bash gives you, then use the #!/bin/sh shebang and make sure it works with sh/ash/ksh.

      --
      Don't blame me, I didn't vote for either of them!
    9. Re:Wouldn't it have been better... by Tet · · Score: 1
      Ummm... no. That would be a different thing. Ash is the Almquist Shell

      No, ash is both. The adventure shell predates the almquist shell by many years. They both happen to use an executable named ash, though.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    10. Re:Wouldn't it have been better... by opk · · Score: 1

      Well there's plenty of books out there on basic /bin/sh shell scripting. This book has a lot more focus on interactive features. I agree that it may be wise to stick to plain POSIX when writing scripts for an embedded system but you do yourself a disfavour if you don't take advantage of bash and zsh's many extras when using them interactively.

    11. Re:Wouldn't it have been better... by Anonymous Coward · · Score: 0

      It's easier to port a shell than a shell script. -- Larry Wall

    12. Re:Wouldn't it have been better... by AKAImBatman · · Score: 1

      Try again. The Adventure shell compiles to advsh, not ash. ASH is, and always will be, the Almquist shell.

    13. Re:Wouldn't it have been better... by Tet · · Score: 1
      Try again. The Adventure shell compiles to advsh, not ash. ASH is, and always will be, the Almquist shell.

      Try again. Maybe it does now (probably to avoid confusion with the Almquist shell), but trust me, when I first encountered it nearly two decades ago, it was installed as "ash". The Almquist shell wasn't even conceived then...

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    14. Re:Wouldn't it have been better... by AKAImBatman · · Score: 2, Informative

      when I first encountered it nearly two decades ago, it was installed as "ash".

      If you're referring to the original script version as opposed to the C port, then the shell name was "ash.sh". Someone might have copied or symlinked it to just "ash" on your system. Here's the original Adventure Shell from Usenet. Note the 1987 timestamp.

  3. Oooo, religious wars!! by smcdow · · Score: 5, Funny

    It's like the good old days!!!

    zshell sux!! bash rules!!

    --
    In the course of every project, it will become necessary to shoot the scientists and begin production.
    1. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 1, Funny

      zshell sux!! bash rules!!

      Did you write that with stuoopid old VI or the great and wonderful Emacs?

    2. Re:Oooo, religious wars!! by AKAImBatman · · Score: 2, Interesting

      Did anyone ever actually argue over ZShell? I thought the primary arguments were always the BASH vs. KSH arguments (i.e. general users vs. hardcore unix admins) and the TCSH vs. BASH arguments (there is *some* validity to TCSH being a bit more professional, but BASH is just more useful).

    3. Re:Oooo, religious wars!! by smittyoneeach · · Score: 2, Funny

      Likely the former, or he'd have touted eshell.el.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    4. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      Isn't Tcsh based on Csh with just a few extra goodies? Read all you want: CSH Considered Harmful .

    5. Re:Oooo, religious wars!! by superpulpsicle · · Score: 1

      It's simple, the premiere shell would have...

      -tab completions
      -color code
      -long ass history list

    6. Re:Oooo, religious wars!! by smcdow · · Score: 1, Troll
      (there is *some* validity to TCSH being a bit more professional, but BASH is just more useful).

      My God. Surely you're joking.

      How, exactly, is tcsh more professional ? And more professional than what? Csh? Using Emacs hexl-mode as a shell is more professional than csh.

      --
      In the course of every project, it will become necessary to shoot the scientists and begin production.
    7. Re:Oooo, religious wars!! by LurkerXXX · · Score: 2, Funny

      What are you talking about? Everyone knows pico is the only editor worth using!

    8. Re:Oooo, religious wars!! by AKAImBatman · · Score: 3, Informative

      Short answer: Yes

      Long answer: I don't think most tcsh users use it for its programming ability. Instead, it tends to be useful as a solid interactive shell. Its general "feel" tends to be more solid than bash, owing partly to the fact that bash has a lot of built in key-shortcuts that tcsh doesn't. Of course, once you're used to being able to double tab for a directory listing, it's kind of hard to give up.

    9. Re:Oooo, religious wars!! by value_added · · Score: 1

      set -o vi

      Discuss among yourselves.

    10. Re:Oooo, religious wars!! by AKAImBatman · · Score: 1

      -color code

      Has anyone actually found this to be useful? I've always found it to be more annoying than anything. The alternative standard (for those of us with purdy graphical terminals on our UltraSparcs) of using Bold and Italics is much easier on the eyes and conveys just as much information.

    11. Re:Oooo, religious wars!! by Reducer2001 · · Score: 0
      vi

      Oh wait, what?

      --
      When you get to hell -- tell 'em Itchy sent ya!
    12. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 5, Funny

      How, exactly, is tcsh more professional

      I once caught bash selling my personal files on ebay. Also, tcsh cured my grandmother of rheumatoid arthritis.

      In related news, emacs is more articulate than vi, three-button mice are sweeter than one-button mice and perl grepped your sister.

      Actually, that last one is true ;-> Sorry.

    13. Re:Oooo, religious wars!! by sp0rk173 · · Score: 2, Informative

      that kind of tab completion exists in tcsh too - just toss set autolist in your .cshrc file. I had it enabled on my last freebsd install - basically makes tcsh work exactly like bash while still feeling more solid. Silly linux kids, when will they learn?!

    14. Re:Oooo, religious wars!! by AKAImBatman · · Score: 1

      Dude, you rock! I just cured my Mac of one of it's longest standing failings! (Yes, I'm too lazy to switch the default shell to BASH.)

    15. Re:Oooo, religious wars!! by sp0rk173 · · Score: 1

      Now that you mention it, bold and italics would look better. Seems kind of like once linux+bash started color coding everything, it became defacto. Any idea how one would go about bolding directories and italicizing executables in tcsh?

    16. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      Wow Slashdotters are in a bad mood today, seems like everything is getting modded down. I mean come on he was joking!

    17. Re:Oooo, religious wars!! by pilgrim23 · · Score: 2, Interesting

      Well actually, the True Believer will go waaaaay back before this Unix upstart and enter the command CATALOG from a Apple Basic 3.3 prompt, or if "modern school", CAT on a ProDOS line.

      Everytime I try to understand a *nix shell parm I have to switch to Emacs and ask the Doctor....

      --
      - Minutus cantorum, minutus balorum, minutus carborata descendum pantorum.
    18. Re:Oooo, religious wars!! by AKAImBatman · · Score: 3, Informative

      IIRC, the standard is:

      Directories are bold
      Links are italic

      I think there were also underlines for something, but hell if I can remember what.

      Here's some links to help you on your way:

      http://www.webservertalk.com/archive109-2004-3-1 44 589.html
      http://sunsite.nus.sg/pub/LDP/HOWTO/mini /Colour-ls

    19. Re:Oooo, religious wars!! by sp0rk173 · · Score: 2, Interesting

      Thank you, kind sir. We have both helped each other out today. Italics on links does make more sense.

    20. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      If mine is +5 funny how is this a troll? Sigh.

    21. Re:Oooo, religious wars!! by fimbulvetr · · Score: 2, Funny

      I rarely find it useful, especially dir and executable colors, but I will tell you what has saved my ass once or twice:

      The big bold red color that tells me a symlink is broken.

      Outside of that one use, I cannot name a another time when I have thanked the color granting shell overlords.

    22. Re:Oooo, religious wars!! by Mr.+Slippery · · Score: 1
      Long answer: I don't think most tcsh users use it for its programming ability. Instead, it tends to be useful as a solid interactive shell.

      Right. tcsh as the login shell, bash for scripting.

      Of course, I was a csh guy back when the only opitions were csh and sh, so I found it a natural upgrade path to go to tcsh.

      Of course, once you're used to being able to double tab for a directory listing, it's kind of hard to give up.

      The tcsh answer is Control-D. That goes back to csh, which is a big reason why some of us used csh over sh. (Actually I think csh was the default user shell on those Ultrix boxes on which I cut my teeth.)

      --
      Tom Swiss | the infamous tms | my blog
      You cannot wash away blood with blood
    23. Re:Oooo, religious wars!! by Mr.+Slippery · · Score: 2, Informative
      The alternative standard (for those of us with purdy graphical terminals on our UltraSparcs) of using Bold and Italics is much easier on the eyes and conveys just as much information.

      Colors? Fonts? Feh. You kids and your fancy terminals.

      The "standard" is to alias ls to 'ls -F'. This appends * to executables, / to directories, @ to symlinks, = for sockets, and | for FIFOs. Works on any terminal.

      --
      Tom Swiss | the infamous tms | my blog
      You cannot wash away blood with blood
    24. Re:Oooo, religious wars!! by AKAImBatman · · Score: 1

      The "standard" is to alias ls to 'ls -F'. This appends * to executables, / to directories, @ to symlinks, = for sockets, and | for FIFOs. Works on any terminal.

      Except for the fact that I absolutely hate that output. It drives me nuts seeing those characters there. IMHO, it looks worse than colors. Give me a Solaris terminal any day.

    25. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      tcsh feels more solid because it has less keyboard shortcuts?

      What?

    26. Re:Oooo, religious wars!! by menace3society · · Score: 1

      In all seriousness, I prefer ed to either of those when I've working on the command line. In addition to being smaller and faster than either (especially over a slow SSH connection), it can be easily scripted if you want to edit files in place. Plus, you get a mad bonus to hardcoreness just for using it.

    27. Re:Oooo, religious wars!! by andreyw · · Score: 1

      Psssh 'ed'? Real men use TECO ;-)

      More info on TECO for those who care.
      http://c2.com/cgi/wiki?TecoEditor
      http://almy.us/teco.html

    28. Re:Oooo, religious wars!! by SamHill · · Score: 1

      Long answer: I don't think most tcsh users use it for its programming ability. Instead, it tends to be useful as a solid interactive shell.

      I agree -- back when I started using the tcsh, my options were the (real) Bourne shell, the basic csh, and I think that was about it (Gould Unix). When I was young and dumb, I'd write scripts in tcsh syntax, but only for really basic things. But the real merits of the tcsh come in interactive mode -- the completion was a revelation, and the ability to do quick loops from the command line was amazing, too.

      Now, of course, bash and other shells have caught up, and, arguably, surpassed the tcsh. Which is why I'm currently reading From Bash to Z Shell myself, and seriously contemplating moving to the zsh in the not-so-distant future.

    29. Re:Oooo, religious wars!! by /ASCII · · Score: 3, Interesting



      Syntax highlighting can give you a great deal of information. I have written a shell called fish, that syntax highlights the commands as you are typing them. What I find useful about this is that fish colors potential errors in red. Mistyped commands, non-existant options, reading from non-existing files and loads of other errors can be identified by just glancing on your screen.

      </shameless plug>

      --
      Try out fish, the friendly interactive shell.
    30. Re:Oooo, religious wars!! by Fred_A · · Score: 1

      People who would most benefit from this probably aren't looking at their screen though but at their keyboard, wondering where the "pipe" key is, rendering the whole thing useless. :)

      --

      May contain traces of nut.
      Made from the freshest electrons.
    31. Re:Oooo, religious wars!! by lewp · · Score: 1

      Don't forget the ASCII art image thumbnails!

      --
      Game... blouses.
    32. Re:Oooo, religious wars!! by /ASCII · · Score: 1

      I use it a lot to see that i got all the switches to commands right. I keep forgetting if it's supposed to be 'mplayer --fs' or 'mplayer -fs', and things like that.

      --
      Try out fish, the friendly interactive shell.
    33. Re:Oooo, religious wars!! by tigersha · · Score: 1

      Real men use echo > a.out

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    34. Re:Oooo, religious wars!! by opqdonut · · Score: 1

      Me too, for some quick replace things it is the best alternative. "sed -i" is nice too, though.

      --
      yes > /dev/dsp
    35. Re:Oooo, religious wars!! by The_Dougster · · Score: 1

      Well, now we do. Back when we only had DOS, which we liked, we did it like this:

      C:\> copy con program.exe

      --
      Clickety Click ...
    36. Re:Oooo, religious wars!! by Nutria · · Score: 1

      Real Programmers toggle programs in from the front panel toggle switches.

      "Jim was able to repair the damage over the phone, getting the user to toggle in disk I/O instructions at the front panel, repairing system tables in hex, reading register contents back over the phone."

      http://www.pbm.com/~lindahl/real.programmers.html

      --
      "I don't know, therefore Aliens" Wafflebox1
    37. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      My reason for using tcsh is the "magic space" key - otherwise known as escape-space. It allows you to expand history commands a la "!rm" before executing them.

      If there was a method for doing this in bash other than
      # echo !rm
      # !*
      I'd love to hear it!

    38. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      (((He) didn't use ((nearly enough) parenthesis) for that (to have been written) (in Emacs).))

    39. Re:Oooo, religious wars!! by Anonymous Coward · · Score: 0

      Just remember this simple rule: mplayer doesn't use readline (for which we are thankful), so it's a single dash.

  4. Which shell is best for you? by Greg+Wright · · Score: 5, Informative

    I think either shell mentioned in the book is great, I personally use
    bash, mostly just because of historical reasons.

    Speaking of different shells in general. Here is a very handy list
    that can help you pick which shell is best for you. This is not meant
    to start a war over which shell is better but is just meant to help
    pick the shell that is best for you:

    http://www.unix.com/showthread.php?t=12274

    Just thought it would be helpful.

    --
    --greg Vulcan quiescent... Q: What machine shutdown with this message?
    1. Re:Which shell is best for you? by opk · · Score: 1

      That chart is years old. Perhaps even as much as a decade.

      There are way more new features that could be added to it. Especially from zsh. Many of zsh's strongest features are not even mentioned.

      For ksh, it is only looking at ksh88 which is what comes with Solaris, AIX etc. ksh93 has many more features related to scripting, some of which this book mentions. Since the release of version 93q earlier this year, ksh is now licenced under the CPL making it properly open source so you can even get it in Debian.

  5. insensitive clods! by tubbtubb · · Score: 1

    What?
    No A shell ??

    1. Re:insensitive clods! by Raelus · · Score: 0

      Rank the parent up, geez. TIs forever, baby!

      --
      "It is the stillest words which bring the storm. Thoughts that come with doves' footsteps guide the world."
    2. Re:insensitive clods! by toddestan · · Score: 1

      I'm more partial to Usgard myself. But I want to know where can I get Bash for my TI-85?!?

  6. What a crappy title... by ikewillis · · Score: 1, Funny

    I would've personally prefered "From ash to zsh"

    1. Re:What a crappy title... by fishbowl · · Score: 1

      > I would've personally prefered "From ash to zsh"

      I had the exact same thought, and couldn't believe someone missed the boat on this. Also holding possibilities is the alphabetical "ash, bash, csh, ..., zsh"

      --
      -fb Everything not expressly forbidden is now mandatory.
  7. What? No "Making vi Sane?" by suitepotato · · Score: 2, Funny

    Other than that omission, I will add it to my "must waste time at Borders sipping coffee and avoiding my insane family" reading list.

    --
    If my grammar and spelling are off, I am [distracted/tired/careless] (take your pick)
    1. Re:What? No "Making vi Sane?" by soupdevil · · Score: 2, Funny

      Some of us avoid our insane families by moving out of the basement and into our own apartments.

    2. Re:What? No "Making vi Sane?" by Anonymous Coward · · Score: 1, Funny

      What are you talking about? vi is perfectly intuitive.:wq

    3. Re:What? No "Making vi Sane?" by MynockGuano · · Score: 1

      Ba-Dum *ching*

  8. Don't believe it. by Anonymous Coward · · Score: 2, Funny

    but this one goes into some litte-seen side streets and alleyways to show you the shortcuts

    Oh sure, those dark alleys might seem to be the shortest route to your destination, but really their just a quick path to a mugging.

  9. Zsh gaining momentum?? :) by Anonymous Coward · · Score: 1, Interesting

    More recent zsh praise from Jochen Maes (Gentoo developer).

    1. Re:Zsh gaining momentum?? :) by Anonymous Coward · · Score: 1

      yeah, some random gentoo weenie mentioning it on his blog is surely signs of gaining momentum.

  10. W00t! Finally! by lpangelrob2 · · Score: 4, Interesting
    A book I might just buy after reading about it on Slashdot.

    I like the Advanced Bash Scripting Guide quite a bit, but I'd also like to learn about other shells, without reading through a mountain of manpages, nor reading through webpages, and just for general interest while riding the El (not because "I need to do x!").

    1. Re:W00t! Finally! by Anonymous Coward · · Score: 0

      I would think that Bash Advanced Scripting Handguide would be appropriate, but...

    2. Re:W00t! Finally! by Big+Mark · · Score: 1

      BASH? What does the B stand for?

    3. Re:W00t! Finally! by Anonymous Coward · · Score: 0

      Um, it probably stands for BASH. Unless you were talking about the shell, then Borne.

    4. Re:W00t! Finally! by Anonymous Coward · · Score: 0

      Born Again SHell

    5. Re:W00t! Finally! by civilizedINTENSITY · · Score: 2, Informative

      Isn't that Bourne Again SHell?

  11. What about COMMAND.COM? by Ann+Elk · · Score: 5, Funny

    Quickly runs out of the room and hides.

    1. Re:What about COMMAND.COM? by EnronHaliburton2004 · · Score: 1

      Quickly runs out of the room and hides.

      Sorry, command.com is so lame I don't think it can even handle a simple command like that.

  12. Oh my god!!! by armando_wall · · Score: 1

    Shell is so powerful! I still remember when I made a war game with it 4-5 years ago! I would kill myself if I had to redo it from scratch nowadays!

  13. also a good book by carnivore302 · · Score: 3, Informative

    Unix shells by example. Just enough in-depth for my taste. Full of tricks you actually will remember, and if you don't remember the exact syntax it can be quickly found in the book again (which I occasionally/often have to do... Kudos to those that can write commands with multiple single and double quotes in one go :-) ).

    The book is mostly on bash, and c-shell.

    --
    Please login to access my lawn
    1. Re:also a good book by Anonymous Coward · · Score: 0

      Gaaaaaahh! If this book is typeset like the first edition, I wouldn't recommend it to my worst enemy.

      Get this - all the shell scripts are printed in DIFFERENT proportional typefaces! I'm not even sure if there's consistency between which shell is represented by a certain font. I defy anyone to be able to read the scripts and tell whether there are embedded spaces. And try to compare two scripts written in different fonts! I had a headache after reading the first couple of chapters of this book, and only glanced at the rest of it to satisfy my morbid curiosity. Caveat Programmer!

    2. Re:also a good book by Anonymous Coward · · Score: 0

      I'm not sure what you're talking about. Tyepsetting is very good and consistent. Do you have the fourth edition?

  14. SASH? by techfury90 · · Score: 2, Informative

    I still can't figure out why the Irix bootloader is called SASH, which means the standalone shell... it would make you think it lets you do unix like things without Irix booted, but nooooo it uses the same syntax and commands even as the PROM monitor uses, except sash can read XFS volumes unlike the boot PROM and list the contents of directories.

    --
    I'm friends with the youngest daughter of the former head of the PowerPC division of IBM you insensitive clod!
    1. Re:SASH? by AKAImBatman · · Score: 1

      but nooooo it uses the same syntax and commands even as the PROM monitor uses, except sash can read XFS volumes unlike the boot PROM and list the contents of directories.

      Huh. You'd think SGI would just improve the OpenPROM code instead. Maybe they felt that would be "too much like Sun". No wonder they fell by the wayside.

    2. Re:SASH? by techfury90 · · Score: 1

      Its nothing like Sun's.... its really odd.. on my Indy it can refer to disks in two notations, one's very NT style, its something like scsi(0)disk(1)rdisk(1)partition(0) for my XFS root partition, whereas the SGI style notation as I call it is just dksc(0,1,0). Apparently they used to use the SGI notation exclusively until the Indigo2/Indy. Thank god my Indy accepts both. The firmware is called ARCS, which may be similar to the ARC firmware for NT. But I dunno...

      --
      I'm friends with the youngest daughter of the former head of the PowerPC division of IBM you insensitive clod!
    3. Re:SASH? by AKAImBatman · · Score: 1

      Its nothing like Sun's.... its really odd.. on my Indy it can refer to disks in two notations, one's very NT style

      Aren't the Indy's the machines that ran Windows NT MIPS Edition? That would explain why it accepts both formats. You could get the machine equipped with either OS.

      Am I misremembering, or did SGI used to use OpenPROM?

    4. Re:SASH? by techfury90 · · Score: 1

      Nope, Indy's IRIX only. IIRC SGI never used OpenPROM.

      --
      I'm friends with the youngest daughter of the former head of the PowerPC division of IBM you insensitive clod!
  15. bash rules! by __aaclcg7560 · · Score: 1

    At the local community college, bash is taught in all the linux classes. They did an informal study about which shell to use, and they found out if the instructor doesn't use bash while teaching how to use the shell, the students can't handle bash when they get to the university.

    The flip-side is that students who don't know how to use the different shells are probably screwed anyway once they get into the real world. Go figure.

    1. Re:bash rules! by pilkul · · Score: 2, Informative
      The flip-side is that students who don't know how to use the different shells are probably screwed anyway once they get into the real world. Go figure.

      If I'm thrown into a shell I don't like, I just type "bash"<enter> and that's that. If the students can't figure that one out, they really are screwed.

    2. Re:bash rules! by robbieduncan · · Score: 1

      And what if bash isn't installed?

    3. Re:bash rules! by vga_init · · Score: 1
      If your college is teaching classes on shell scripting, I can understand the availability of bash courses because of its popularity in the ever growing linux world, but you make it sound like what is mainly being taught here is how to interact with the shell (ie "use it").

      Because of scripting, even the slightest difference between shells becomes very important, but for interactive use the differences often become trivial. Anyone who is familiar with any sort of unix shell can "handle" bash, even if they aren't aware of all of its nifty features.

      I started learning the unix shell with bash, and later I made the decision to switch over to tcsh, which is now the stock shell I choose for login. The basics I learned in bash carried right over, and what difference I had encountered only took a few minutes to learn and adjust to. I imagine it would have worked the same way if the migration went the other direction.

      Different shells have a lot to offer, but basic intercompatibility allows us not to be totally stumped by one shell or another.

      I personally would like to know the details of that study you mentioned. Is it possible that rather than not being able to handle bash at the universities, the students simply choose not to use it because they prefer something else? After all, we tend to stick with what we know, and students who don't learn bash first probably continue with their original shell at the university.

    4. Re:bash rules! by Kiryat+Malachi · · Score: 1

      (if needed due to install lockdowns root exploit and) Install it, of course!

      --

      ---
      Mod me down, you fucking twits. Go ahead. I dare you.
      (I read with sigs off.)
    5. Re:bash rules! by fforw · · Score: 1
      And what if bash isn't installed?
      bash: command not found
      --
      while (!asleep()) sheep++
    6. Re:bash rules! by __aaclcg7560 · · Score: 1

      I personally would like to know the details of that study you mentioned. Is it possible that rather than not being able to handle bash at the universities, the students simply choose not to use it because they prefer something else?

      It was an informal study (probably an end-of-semester survey) conducted by the department for it's own internal use. The instructor mentioned it during the linux course on why we were using only bash for the scripting excercises. I think the real problem is that some students don't have the ability or just don't want to think outside of the box.

    7. Re:bash rules! by vga_init · · Score: 1

      Yeah, I can see how compatibility can break very easily in terms of scripting exercises. I've noticed that sometimes it's hard to find the proper resources in the online documentation for figuring out little scripting quirks. Maybe it'd be easier for them to utilize a different shell if more help were available in that area.

    8. Re:bash rules! by CoughDropAddict · · Score: 1

      And what if bash isn't installed?

      Go buy some champagne, to celebrate the fact that I have somehow invented a time machine that will take me back to 1993.

  16. All your Bash are belong to Ksh by WillAffleckUW · · Score: 1

    last time I used Z shell was when I dialed in via z-term, and that's so long ago I can't remember which century it was ... or if my modem went faster than 300 baud.

    --
    -- Tigger warning: This post may contain tiggers! --
  17. Why I love zsh by winkydink · · Score: 5, Interesting

    Back in '91 or so, I lost legitamate source-code access to ksh. bash was around but, at the time, it only had emacs-like command-line editing. I then discovered that a bunch of folks in the CS dept at Princeton were developing a new (to me anyway) metashell called zsh that was, for the most part a ksh workalike with vi-like command-line editing.

    One thing I have never been able to do successfully is to emulate the old ksh's ability to hit Esc-Esc on the command line and get popped into vi with the last command in the history file ready to be edited. It was such a boon to rapid development of shell scripts. Then again, I don't do as much shell scripting these days, so its probably no great loss.

    If anybody knows how to do this, esc-esc thing in zsh and can tell me, I'd be really grateful.

    --

    "I'd rather be a lightning rod than a seismometer." -Ken Kesey

    1. Re:Why I love zsh by OrangeTide · · Score: 1

      bindkey -v

      put that in your ~/.zshrc if you always want vi keys enabled. Or you could have bought the book that was reviewed.

      --
      “Common sense is not so common.” — Voltaire
    2. Re:Why I love zsh by winkydink · · Score: 1

      I'm sorry, that wasn't my question. I know of bindkey -v. I've been using the shell for 14 years.

      My question is, how do I make the command esc-esc put the last command in the history file into a full vi session?

      Or, in simpler terms, how do I make esc-esc execute the 'fc' command? I've tried lots of clever ways over the years, none of them have worked.

      --

      "I'd rather be a lightning rod than a seismometer." -Ken Kesey

    3. Re:Why I love zsh by Anonymous Coward · · Score: 0

      Esc-K? Or I just not understanding you fully...

    4. Re:Why I love zsh by Anonymous Coward · · Score: 0

      Something like:
      bindkey -s '^[^[' 'fc\n'

    5. Re:Why I love zsh by Anonymous Coward · · Score: 4, Interesting

      Whilst I am no expert on ZSH, the following seems to do what you ask for

      bindkey -s '\e\e' 'fc\n'

      This is with a freshly updated debian 'unstable' system,

      zsh --version
      zsh 4.3.0-dev-1 (i686-pc-linux-gnu)

    6. Re:Why I love zsh by Alakaboo · · Score: 2, Informative

      In bash (and ksh) I hit ESC to enter command mode, then v to bring up (v)isual mode. Perhaps zsh is similar? HTH.

    7. Re:Why I love zsh by EnronHaliburton2004 · · Score: 1

      I think I remember what you are talking about...

      Are you thinking of 'ESC-k' (or 'ESC-up-arrow') which opens the commandline history? That's like the 'fc' command, without opening a vi session.

      In the ksh93, the vi command-line editing actually consisted of some vi-style commands, some ksh-only style commands, and some emacs-style.

      I think the ESC-ESC was a ksh-only command, or it was some common binding on some OSs... but it wasn't universal. ksh93 was annoyingly different on Solaris 8 vs HPUX or AIX. Drove me crazy...

    8. Re:Why I love zsh by winkydink · · Score: 1

      No, I use Esc-k and Esc-/ (search) all day long.

      Esc-Esc might have been a ksh-only command, which would explain why I can't get it work with zsh. It really changed how I protyped shell scripts and probably helped me move to perl (if I have to open the editor window anyway, etc...)

      --

      "I'd rather be a lightning rod than a seismometer." -Ken Kesey

    9. Re:Why I love zsh by winkydink · · Score: 1

      (thank you) * 1000

      That works! It must have been fixed sometime since 4.0 (which I think was when I finally abandoned hope).

      --

      "I'd rather be a lightning rod than a seismometer." -Ken Kesey

    10. Re:Why I love zsh by Anonymous Coward · · Score: 1, Informative
      I use these bindings in zsh:
      bindkey "\ee" edit-command-line
      bindkey "\Me" edit-command-line

      Thats Escape-e and Meta-e.

      edit-command-line should bring up the current commandline in the program $FCEDIT.
      I set FCEDIT=vim.

    11. Re:Why I love zsh by Anonymous Coward · · Score: 0

      Works for me on OS X, thanks.

    12. Re:Why I love zsh by Anonymous Coward · · Score: 0

      When will this feature come into testing you think?

      Will it be in the next stable?

      heh, I kill me.

  18. Best shell by Kaa · · Score: 4, Funny
    My shell is
    perl -d -e 42
    --

    Kaa
    Kaa's Law: In any sufficiently large group of people most are idiots.
    1. Re:Best shell by Anonymous Coward · · Score: 0
      My shell is
      $ emacs -nw --eval (eshell)
    2. Re:Best shell by Anonymous Coward · · Score: 0

      Finally, a legimate use for perl!

  19. zsh by lakerdonald · · Score: 0

    Having only used zsh once or twice, I can't exactly be cited as an "expert", but I do seem to like it a lot. It's very powerful, especially when it comes to command line globbing. Hopefully this book goes into those customization options in depth, as that is the true power of zsh in my opinion.

  20. Eh? by Anonymous Coward · · Score: 0
    This is not meant to start a war over which shell is better but is just meant to help pick the shell that is best for you:

    And you think this statement will calm the huddled masses yearning to let loose with a litany of zealotry comments about their favoutite shell, the likes of which you have never had the pleasure of hearing?

  21. shell war game..... by ocularDeathRay · · Score: 2, Funny

    bash$ Shall we play a game? bash$ How about Global Thermonuclear War

    --
    Obama is a twitter sock puppet
    1. Re:shell war game..... by Anonymous Coward · · Score: 0

      bash: Shall: command not found

  22. ARCS by green+pizza · · Score: 1

    SGI's MIPS-based machines (and their first NT PC too) used an ARCS PROM and SASH bootloader. These come from the Advanced RISC Computing Specification, back in the pre-Pentium days when people thought Intel was about to drop into obscurity.

    SASH is pretty slick, actually.

    1. Re:ARCS by techfury90 · · Score: 1

      Correct, it indeed is slick, but I wish it was a little more like unix... just for the coolness factor. Its very useful though.

      --
      I'm friends with the youngest daughter of the former head of the PowerPC division of IBM you insensitive clod!
  23. New ideas by /ASCII · · Score: 2, Informative



    I think both zsh and bash could use a redesign. The syntax is crufty, with stupid variable assignment syntax ('foo = bar' is not the same thing as 'foo=bar'? '$foo' is not the same thing as `$foo` or "$foo"?), insufficient tab-completion support and very few features enabled by default.
    I have written a shell called fish. It has lots of new features. Check it out.

    </shameless plug>

    --
    Try out fish, the friendly interactive shell.
    1. Re:New ideas by Macrobat · · Score: 1
      '$foo' is not the same thing as `$foo` or "$foo"?

      echo $foo
      will give you the value of $foo (say, "bar").

      echo "$foo"
      will return the string "$foo"

      `$foo`
      will give you the output of the command, if the value of foo is set to a recognized command. Useful for combo commands.

      These are convenient, and not too hard to remember. Just out of curiosity, how are these things done in fish?

      --
      "Hardly used" will not fetch you a better price for your brain.
    2. Re:New ideas by /ASCII · · Score: 2, Informative

      No, you are wrong.

      In bash:

      $foo gives you the contents of variables foo as a list of space-separated strings. "foo bar" becomes "foo" and "bar".

      "$foo" gives you the contents of variable foo as a single variable. "foo bar" remains "foo bar".

      '$foo' gives you the string "$foo".

      `$foo` executes the command pointed to by the variable foo in a subshell. If foo has the value "ls" executes the "ls" command.

      In fish:

      $foo gives you the contents of variable foo as a single string, "foo bar" remains "foo bar".

      "$foo" and '$foo' both give you the string "$foo".

      And those are all the quoting styles allowed in fish.

      --
      Try out fish, the friendly interactive shell.
    3. Re:New ideas by Anonymous Coward · · Score: 0

      Personally I never use backquotes in bash, dreadful things. Too likely to get screwed up if you copy & paste for one. Better to use $(crazy_command), and easier to read.

    4. Re:New ideas by lawpoop · · Score: 4, Funny

      A shell called fish? Can you call it shellfish for short? Did you make it GPL? If so, thanks for not being selfish with shellfish!

      --
      Computers are useless. They can only give you answers.
      -- Pablo Picasso
    5. Re:New ideas by Anonymous Coward · · Score: 0

      I was looking at your site, and am very impressed with what you've done with fish. I will be downloading it to try it out, tonight. I use the backticks in bash, or the $(...) syntax frequently, however to take the output of another program and put it into my command. Is there any acceptable way to do this in fish?

    6. Re:New ideas by Macrobat · · Score: 1
      No, I am (mostly) right and you are (partially) wrong.

      If the value of $foo is "bar", then $foo, "$foo", and '$foo' all give the error "bash: bar: command not found"

      echo $foo
      and
      echo "$foo"
      both return "bar."

      echo '$foo'
      returns "$foo." If $bar has the value "ls", then
      grep foo `$bar`
      will search for 'foo' in whatever is listed in your directory.

      My basic point was, the quoting mechanism is no more complicated than the (US) English sentence: I said, "He explicitly said to me, 'don't feed them after midnight.'" And the multiple quote styles are necessary for approximately the same reason--you need to talk sometimes about the quotation, and sometimes about the meaning of the quote.

      --
      "Hardly used" will not fetch you a better price for your brain.
    7. Re:New ideas by Sinner · · Score: 1

      You went to all the trouble to write a shell because you couldn't be bothered to figure out the difference between "$foo" and '$foo'?

      It's a pity, because I've been wanting a shell that can tab-complete wildcards, but as someone who makes use of the difference between "", '' and ``, using your shell would be an exercise in frustration.

      --
      fish and pipes
    8. Re:New ideas by Mornelithe · · Score: 1

      zsh can tab-complete wildcards.

      --

      I've come for the woman, and your head.

    9. Re:New ideas by the+way,+what're+you · · Score: 1

      Right, but consider variables with spaces. Here's what the OP is getting at:
      #!/bin/bash
      foo="foo bar"
      for baz in $foo; do echo "1: $baz"; done
      for baz in "$foo"; do echo "2: $baz"; done
      produces output:
      1: foo
      1: bar
      2: foo bar
      ... because in bash, $foo is treated as a list of space-separated strings, while "$foo" gives the entire contents of the variable.

      On the other hand, 'fish' tries to avoid this, and presumably would produce:

      1: foo bar
      2: $foo
      --
      example.org - powered by Linux!
    10. Re:New ideas by UN1XG0D · · Score: 1

      err but does it do global aliases? if so I may consider testing it out. Till then its zsh or nothin

      --
      UNIX: A set of Linux-like operating systems that grew out of an original version written by some guys at a phone company
    11. Re:New ideas by CoughDropAddict · · Score: 1

      I think you're a little bit confused about how shells like bash work.

      If you write $foo when foo="foo bar", it does not "become" two separate strings. Variable interpolation in shells is just a textual search-and-replace. So if you write:

      $ ls $foo

      Here's what the shell does:

      1. Perform variable interpolation: now the command is ls foo bar

      2. Interpret the command. It splits the command into parameters using the contents of IFS, which is set to space, tab, and newline by default. So now the command is:

      program=ls
      param1=foo
      param2=bar

      The shell doesn't "remember" that the string "foo bar" came from a single variable interpolation. It's exactly as if you typed the command with the variable replaced with its value.

      If you don't understand this properly, you can run into weird syntax errors when variables expand in ways you don't expect. For example:

      $ if [ $unsetvar = "" ] ; then echo hello ; fi
      zsh: parse error: condition expected: =


      Since $unsetvar expanded to nothing, the line became:

      $ if [ = "" ] ; then echo hello ; fi

      Now the syntax error is obvious. This is a fundamentally different model of variable evaluation than most programming languages have.

    12. Re:New ideas by /ASCII · · Score: 1

      Yes. Use (...) for subshells. I hope you'll like fish!

      --
      Try out fish, the friendly interactive shell.
    13. Re:New ideas by Sinner · · Score: 1

      Cool. I think I tried it briefly when I was looking for a replacement for tcsh that would play nice with Japanese characters.

      IIRC, zsh was not significantly less frustrating for a long-time tcsh user than bash was, and bash's i18n support was better.

      At the moment I mostly use bash and put up with the frustration when Ctrl-R and Esc-? and Esc-p don't do what I expect. Now that you mention it, it sucks. grrrr.

      --
      fish and pipes
    14. Re:New ideas by /ASCII · · Score: 1

      I was referring to what the result of globbing on the different parameters, I was not talking about what would be the result of trying to use values like '$foo' as a command, which does not make sense.

      Like a previous poster pointed out, echo $foo does not do what you think it does, it just happens to work in your example since your string does not contain spaces.

      --
      Try out fish, the friendly interactive shell.
    15. Re:New ideas by /ASCII · · Score: 1

      It is GPL'ed. :-)

      --
      Try out fish, the friendly interactive shell.
    16. Re:New ideas by Anonymous Coward · · Score: 0

      I wish you where right. The macro expantion you describe is exactly how early shells like sh worked. Bash does not work that way. Bash uses a full lexx Yacc grammar and it is generally implemented like your standard programming language.

      Here are two examples of how you can notice this:

      bash> foo="-l; pwd"
      bash> ls $foo

      will give you a syntax error.

      bash> foo=bar
      bash> foo=baz; echo $foo

      will output baz, not bar.

      So, as you can see, Bash is _not_ a macro expanding language. It just _pretends_ to be, by separating variables on spaces.

    17. Re:New ideas by /ASCII · · Score: 1

      I goggled '"glob alias" zsh' and a few other strings, but came up with no information. If you could describe what a glob alias is, I will be happy to tell you if fish supports something like it.

      --
      Try out fish, the friendly interactive shell.
    18. Re:New ideas by /ASCII · · Score: 1

      Belive me, I know the difference between '$foo' and "$foo" and `$foo`. I just don't think it is a good syntax. The fact that every time I write a shellscript, I have to go over it afterward to see that every time I use a variable, it is enclosed with quotes drives me nuts. The fact that

      for i in a b c; do; echo $i; done

      is a syntax error (too many ';') is also stupid.

      I _know_ that variable assignments are whitespace sensitive, but in my opinion no good language should be.

      I don't like the fact that if blocks end with 'fi', case blocks with 'esac', but loop block end with 'done'. Even more disturbing is the subblocks of a case statment. they end with ';;'. Where is the logic?

      Fish has a consistent block syntax borrowed from MATLAB:

      for i in foo bar baz;
      echo $i;
      end;

      while true;
      echo fish rules!
      end;

      if [ $SHELL = fish ];
      echo yay;
      end;

      switch $SHELL
      case "f*";
      echo could be a fish
      case "*"
      echo not a fish
      end;

      I could make a list ten pages long of issues that I have with bash syntax. fish does _not_ fix all of these issues, and I'm sure it introduces a few new ones. But I firmly belive that it has a much saner syntax. And I am continually trying to improve the fish syntax until fish is to bash what Python is to Intercal.

      --
      Try out fish, the friendly interactive shell.
    19. Re:New ideas by opk · · Score: 1
      for i in a b c; do; echo $i; done
      is a syntax error (too many ';') is also stupid.


      It isn't an error in zsh.

      I _know_ that variable assignments are whitespace sensitive, but in my opinion no good language should be.

      So how does fish allow you to run a command named foo with equals as the first argument? Do you need to quote the equals.
      while true;
      echo fish rules!
      end;

      Do you really need semi-colons after all those lines?
    20. Re:New ideas by Mornelithe · · Score: 1

      Hmm.. Yeah, I do believe zsh is largely sh/bash/ksh based, although it borrows from a lot of things (I'm by no means an expert in shell history, as I've only been using Linux/Unix seriously for... 3 years or so now).

      From what I've looked at of the documentation, it does have a lot of optional csh (that is what tcsh is ultimately based around, no?) derived semantics (many features have both bash and csh styled ways of accessing them). But I think it leans more heavily toward the bash/ksh end of things, so I imagine it'd be hard to adapt from tcsh, or other dissimilar shells.

      Then again, I wouldn't know, as I've never really used---let alone learned---shells other than bash and zsh. :)

      --

      I've come for the woman, and your head.

    21. Re:New ideas by /ASCII · · Score: 1

      Fish uses a builtin command called 'set' to assign variables. Instead of 'foo=bar' you write 'set foo bar'.

      Using set is slightly wordier, and may look a bit strange to people who are used to 'foo=bar', though csh users should feel comfortable. The reason for doing it this way is to make the language uniform. In fish _everyhing_ is a command. for and switch are just builtin commands, they follow the same syntax rules as any other command. I feel that by making the syntax small and uniform, fish is easier to learn.

      If I where to use a syntax using '=', it would be '$foo = bar', since a variable should not be allowed as the first token of a command anyway. If you _want_ to execute the contents of a variable, use eval.

      BTW, fish uses ';' and newlines as command delimiters, so you do _not_ need to have semicolons at the end of the lines like in my example. I put them there out of habit.

      --
      Try out fish, the friendly interactive shell.
    22. Re:New ideas by /ASCII · · Score: 1

      *doh*

      I just noticed you said _galobal_ alias, not glob alias. My bad.

      I looked global aliases up, and I must say that I don't like the idea. There is far to little benefit and far to many ways to shoot yourself in the foot. Sorry.

      --
      Try out fish, the friendly interactive shell.
    23. Re:New ideas by d^2b · · Score: 1
      I had a quick look at fish, and the X-clipboard integration features looked interesting. Has anyone experimented with integrating pointer use into the shell, e.g. to select from completions? I'm not sure how this would work out, but it seems worth thinking about. Heck, in general we are running shells on bitmap displays, but we don't really take advantage of that. Yes, I know, it would still have to work in tty mode, but XEmacs seems to have pioneered that reasonably well.

      Yeah, OK, tell me what a clueless GUI-bound newb I am, but only if you were born after 1985, the year I started using Multics via 1200 baud modems :-)

    24. Re:New ideas by Sinner · · Score: 1
      If I where to use a syntax using '=', it would be '$foo = bar', since a variable should not be allowed as the first token of a command anyway. If you _want_ to execute the contents of a variable, use eval.
      It's common in scripts to run a command named in a variable, particularly on Solaris, where there seems as a rule to be at least two versions of any given command, one of which is hideously broken, and getting the right one is critical.

      But then, I get your point that for interactive use that doesn't really matter. Which is just as well, because eval tends to turn quoting into a minefield.

      --
      fish and pipes
    25. Re:New ideas by Sinner · · Score: 1
      I don't like the fact that if blocks end with 'fi', case blocks with 'esac', but loop block end with 'done'. Even more disturbing is the subblocks of a case statment. they end with ';;'.
      Can't disagree with you there. I get these moments of anxiety when I'm writing sh-code... "what the hell does this block end in?"

      Here's the kind of thing I end up doing a lot of on the command-line:

      for tif in *.tif; do
      tiftoppm $tif | cjpeg >`basename $tif .tif`.jpg
      done

      How does that work out in fish?

      --
      fish and pipes
    26. Re:New ideas by /ASCII · · Score: 1
      I am planing on doing the following mouse integration in fish:
      • Click with mouse to move cursor
      • Select completions using mouse cursor

      There is already an extension script for zsh which lets you move the cursor using the mouse, which can be downloaded here. (Note: I am not the author of the zsh mouse support. )

      --
      Try out fish, the friendly interactive shell.
    27. Re:New ideas by /ASCII · · Score: 1

      The same command in fish:

      for tif in *.tif
      tiftoppm $tif | cjpeg >(basename $tif .tif).jpg
      end

      Please note that the fish version will work with any files, but the bash version you posted will break on files with spaces because of the braindead tokenizing support in Bourne shells.

      --
      Try out fish, the friendly interactive shell.
    28. Re:New ideas by /ASCII · · Score: 1

      I've experienced this problem on Solaris as well. I usually solve this by changing the PATH.

      If that doesn't work, I would propose the use of aliases instead of environment variables to point to the correct command. But if you want to be all hardcore and use eval, quoting is much less of a minefield in fish, because of the simpler quoting rules. :-)

      --
      Try out fish, the friendly interactive shell.
    29. Re:New ideas by UN1XG0D · · Score: 1

      alias -g G='|grep' works like a regular alias but anywhere on the command line ie. ps aux G sshd

      --
      UNIX: A set of Linux-like operating systems that grew out of an original version written by some guys at a phone company
    30. Re:New ideas by UN1XG0D · · Score: 1

      Shoot yourself in the foot? Of course, because capital G's are used so much on the command line. O well, zsh it is. Good luck anyway.

      --
      UNIX: A set of Linux-like operating systems that grew out of an original version written by some guys at a phone company
    31. Re:New ideas by /ASCII · · Score: 1

      Hmmm. If you cound bing a keyboard shortcut to inserting a string into the commandbuffer, you could add the string ' | grep' to Meta-G, or something like that.

      This would not cause evil syntax issues but still allow you the power of global aliases. Could be done with very little effort.

      --
      Try out fish, the friendly interactive shell.
    32. Re:New ideas by jgrahn · · Score: 1
      I don't like the fact that if blocks end with 'fi', case blocks with 'esac', but loop block end with 'done'. Even more disturbing is the subblocks of a case statment. they end with ';;'. Where is the logic? ... Fish has a consistent block syntax borrowed from MATLAB ...

      This is how I always imagined csh got started, except s/MATLAB/C/ ... and we all know how that ended. (Not that there isn't anything good about csh -- tcsh is my preferred shell, until I have the time to hack zsh to do tab completion the way I want it -- set autolist=ambiguous; set complete=enhance)

    33. Re:New ideas by dublin · · Score: 1

      Heck, in general we are running shells on bitmap displays, but we don't really take advantage of that.

      Don't feel bad, I'm a lot older than that, and it's frustrated the heck out of me for years that no one's ever really done much in the way of mouse/shell integration in ways that make the most of both GUI and command line environments. Here's one thing I've wanted for years, just because it's so intuitive: In your terminal window, don't just color-code the listing, make it live (via HTML rendering or whatever), so that double-clicking on a filename (after displaying it with "ls -l" or whatever) will open it in a reasonable, default way (according to extension, type/creator, MIME type, or registry settings, depending on the underlying OS). This combines the best of the command line with the best of a GUI file manager, especially when integrated with a powerful shell environment and a suitably flexible and graphic history mechanism. After doing that directory listing, why shouldn't I be able to drag a filename into a directory just like in a GUI file manager?

      --
      "The future's good and the present is nothing to sneeze at." - Roblimo's last ./ post
    34. Re:New ideas by Sinner · · Score: 1
      Please note that the fish version will work with any files, but the bash version you posted will break on files with spaces because of the braindead tokenizing support in Bourne shells.
      I was aware of that when I posted it, but I left the bug in there for the sake of realism (I make that mistake on a regular basis; probably most people do). I don't think Bash is braindead, I think it's just a case of bad defaults--most of the time when people write $tif in bourne shell, they mean "$tif".

      I've noticed a couple of points in what you wrote: I assume from your example that the (basename $tif .tif) part is expanded after tokenisation, and hence will always work even if the filename has a space in. But in that case, how do you do something like:

      mv `egrep '\.jpg$' filelist.txt` jpegfiles/

      ? This relies on tokenisation happening on the subshell output.

      Also, since () now means what `` used to mean, how do we do what we used to do with ()? ie. stuff like

      (echo From: me; echo To: you; echo Subject: the file; echo ""; cat thefile.txt) | sendmail -t

      That's not a great example, but you get the idea.

      --
      fish and pipes
    35. Re:New ideas by /ASCII · · Score: 1

      subshell items _are_ tokenized, but only on newlines. so doing

      echo (ls)

      in a folder containing the files 'foo' 'bar' and 'baz qux' will run the echo command with the arguments 'foo', 'bar' and 'baz qux', just like you would expect.

      If you want to separate a variable into tokens on space, you can use someting like this:

      set foo "bar baz"
      for i in (tokenize $foo)
      echo $i
      end

      As to the old meaning of (), right now You'd have to do someting like:

      echo From: me >/tmp/woot
      echo To: you >>/tmp/woot
      echo Subject: the file >>/tmp/woot
      [...]
      sendmail -t /tmp/woot
      rm /tmp/woot

      Ugly, ugly, ugly. The syntax that I have planned for this kind of thing is to allow redirection of output from blocks of commands, so you could do this:

      if true
      echo From: me
      echo To: You
      [...]
      end | sendmail -t

      This is _not_ implemented yet, I plan on implementing this in about a month. But I really like that syntax, since I find it very readable, it is a natural extention of the current syntax, and it is only slightly wordier than the special case solution. I am currently working on a syntax for environment variable arrays and simplifying the alias syntax, and allowing redirection from blocks will fall out naturally from those changes.

      --
      Try out fish, the friendly interactive shell.
    36. Re:New ideas by /ASCII · · Score: 1

      Some terminal emulators support clicking on URLs to open them. It's not exactly what you want, but it's a start. I think the terminal emulator layer is the right place to implement your ideas, since that way, they will automatically function on any program.

      --
      Try out fish, the friendly interactive shell.
    37. Re:New ideas by dublin · · Score: 1

      I'd like to suggest that you build and distribute fish for the Windows environment as well. I suggest U/Win as the base environment, although you could use the vastly inferior cygwin if you have to.

      Seriously, there are a whole lot of us that find it's infinitely easier to add Unix tools to our Windows environments than to try to make Unix or Linux do a poor imitation of Windows. In today's world, you really need both. I'm interested in fish, but niotice that there are no binaries availble for Windows. (Yes I *can* compile things, but I refuse to - I plan to live the rest of my life and never again use a compiler. I do write a great many scripts though - in fact, the reason people choose scripts in the first place is that they want something that's way easier and more powerful than dealing with low-level languages and thier compilers!)

      --
      "The future's good and the present is nothing to sneeze at." - Roblimo's last ./ post
    38. Re:New ideas by /ASCII · · Score: 1

      It is possible that csh started out the same way fish did, but the fact that someone tried to fix the sh syntax and failed does not mean that the sh syntax can't be fixed. :-)

      --
      Try out fish, the friendly interactive shell.
    39. Re:New ideas by /ASCII · · Score: 1

      I've had users trying to build fish under Cygwin, but it seems Cygwin does not support wide character functions or the terminfo database, both of which are needed by fish. I do not know if these issues where local to that users version/installation, and I do not know if U/Win and MinGW also have these issues, but since I do not own a Windows machine I am not able to do a lot about the situation. If someone familiar with one of the UNIX layers for windows would take the time to make fish work under Windows, I would be very happy to help Windows users get access to fish.

      --
      Try out fish, the friendly interactive shell.
    40. Re:New ideas by Sinner · · Score: 1
      subshell items _are_ tokenized, but only on newlines.
      Sweet! That seems pretty much the perfect solution.
      The syntax that I have planned for this kind of thing is to allow redirection of output from blocks of commands,
      That makes a lot of sense. It's about time someone did this. Good job.
      --
      fish and pipes
  24. wow....yuo are teh asstard by Anonymous Coward · · Score: 0
  25. Unicode by olafc · · Score: 5, Insightful

    I like zsh and use it a lot, but there is just one big feature still missing: proper unicode support.

    I know they started working on it in february, at least more actively then before. So it will come eventually. Once the internals are done they will move on to the line editor.

    Untill then, it still "eats" my prompt when backslashing over multibyte characters... :(

    1. Re:Unicode by ravee · · Score: 1

      Does bash support unicode? I mean can I get error messages in my favourate language in bash?

      --
      Linux Help
      for all things on Linux
    2. Re:Unicode by /ASCII · · Score: 1

      Bash supports unicode. I'm not sure if the error messages have been translated to Klingon yet.

      --
      Try out fish, the friendly interactive shell.
  26. Suggestion by metamatic · · Score: 4, Funny

    I cordially propose that the default prompt of your new shell be changed to

    }><(([@>

    for reasons which should be obvious.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    1. Re:Suggestion by /ASCII · · Score: 0

      Awesome! =D

      --
      Try out fish, the friendly interactive shell.
  27. Wicked! by veg_all · · Score: 4, Informative
    . After the binding, typing CTRL-x t puts the string 'March 2004' onto the command line, and moves the cursor under the '2' so you can insert the day of the month.

    What a timesaver! I start so many commands with
    $ March 2004
    In all seriousness, though, I'd like to stick my suggestion in here: Wicked Cool Shell Scripts is a charming little read and the scripts are all on line!

    --
    grammar-lesson free since 1999. (rescinded - 2005)
  28. TI-85 by Gadgetfreak · · Score: 1

    I may be one of the few here who don't do much in the way of coding (I'm a MechE) but I can't be the only person reminded of the TI-85 application called ZShell. Anyone else have fond memories of this?

    --
    "No fair, you changed the outcome by measuring it!" - Professor Hubert J. Farnsworth
    1. Re:TI-85 by dahlek · · Score: 1
      Oh yeah.

      Fond memories, lol. I got into the 85 thing a bit late - Usgard (sp?) was already out. It was a better OS, and it had support for zshell "apps", like that really good Tetris game that actually had a multiplayer option via the link cable...

      I wrote my own game for the 85 in smallC for Usgard. It's still at ticalc.org, though I haven't updated it in years...

      Anyway, it was too cool realizing that they turned a calculator into a general purpose computer, and kudos to Ti for making this a standard feature now on their new calcs. I can't believe they actually had TSR programs for Usgard - I used to run one which would take screen captures with a keypress.

      Fully interruptable OSes on a calculator with 32k, with programs stored as strings - it was a geeks dream come true, lol...

      If I remember right, they even had some games with sound - if you plugged a speaker into the link-port ;)

      Of course, the more I ramble on, the more I'm off-topic. Bash! Bash rocks! I've written and still use many a bash-script, though I can't get over the way bash closes blocks - if...then...fi, or case...esac - gives me the willies!

  29. Mr Old fashioned by mrbooze · · Score: 3, Insightful

    Every shell script I write can run in a non-dynamic bourne shell. With all my years of supporting dozens of different flavors of unix, I grew accustomed to never assuming what shells may or may not be available on a given system.

    #!/bin/sh 4 LIFE!

    1. Re:Mr Old fashioned by menace3society · · Score: 1

      Yeah, except that it might not actually be *sh*. Bash, ksh, and zsh all do compatibility modes, and all are (at least to some extent) mutually incompatible. So you're fucked, basically.

    2. Re:Mr Old fashioned by PigleT · · Score: 2, Insightful

      For scripting, maybe, unless you know the script isn't going to go off your box. For actual command-line interaction, give me zsh or give me death. "Compatibility" is no reason not to learn what fun *can* be had.

      --
      ~Tim
      --
      .|` Clouds cross the black moonlight,
      Rushing on down to the circle of the turn
    3. Re:Mr Old fashioned by Zapd · · Score: 1

      Ahh.. shell hell..

      Do you know your operators? The following code should produce an error. But it doesn't always:

      Linux: /bin/sh (actually bash)
      $ if [ foo == foo ] ; then echo yes ; fi
      yes

      FreeBSD: /bin/sh
      $ if [ foo == foo ] ; then echo yes ; fi
      [: foo: unexpected operator

      Solaris /bin/sh:
      $ if [ foo == foo ] ; then echo yes ; fi
      test: unknown operator ==

      ksh behaves like bash (prints "yes"). zsh behaves like this:
      % if [ foo == foo ] ; then echo yes ; fi
      zsh: = not found

      --
      The imp hits!
    4. Re:Mr Old fashioned by /ASCII · · Score: 2, Interesting

      While I acknowledge the existance of shell hell, I don't think your example is evidence of it. You highlight the fact the some versions of test allow for '==' to mean the same thing as '='. This, I'm sure, was done to prevent a common, harmless user error from causing trouble. All you have to do to steer clear of such problems is not to rely on 'test' to support non-standard options.

      There is however another problem related to the one you outline above. bash, zsh and probably most of the other shells in your example do not use the standard test command, but do instead use a builtin with the same name. I think including dozens of standard unix commands such as kill, test and printf in the shell binary as builtins is a design mistake. It breaks the unix tradition of doing one thing and doing it well. At least bash has had some trouble with fd redirections and builtins. A bug in a builtin may cause the entire shell to crash. When the user switches shells or invokes a program directly, and not through the shell, he/she may find out that the programs syntax has changed!

      For the reasons outlined above, I think the only commands that the shell should provide as builtins are the ones that can not be implemented as a separate command, such as cd, exit and if.

      --
      Try out fish, the friendly interactive shell.
  30. autolist by Anonymous Coward · · Score: 0

    Even better is:

    set autolist=ambiguous

  31. zsh plug: Recursive file completion by gidds · · Score: 4, Interesting
    A good chart, but it omits the single feature which for me puts zsh head and shoulders over the others: recursive globbing.

    I used to find myself using find a lot -- mostly for handling files in subdirectories, and/or for selecting files based on metadata of various kinds. But zsh makes find almost totally unnecessary: it has a simple but very powerful syntax which extends the simple '*' and '?' file completion to allow selection by size/date/type/&c, exclusion lists, user-specified ordering, and most usefully it can select files in subdirectories too. And because it's right there in the shell, the results are easy to use without that awkward -exec syntax. I don't think I've used find once since switching to zsh!

    I really don't understand why it hasn't become more popular. It's free and open source; it can mimic other shells (notably, ksh), and it ships with systems such as Mac OS X.

    --

    Ceterum censeo subscriptionem esse delendam.

    1. Re:zsh plug: Recursive file completion by Sq · · Score: 2, Interesting

      "find -exec grep ..." (for example) is awkward, and it is bloody too slow (it executes command for EVERY file)

      that's why you want to use something like:
      find | xargs grep
      which will not only execute grep only once per few thousand files, but it will also work where ZSH's
      "grep ... **/*" won't -- when there are too many files (yes, UN*X has a limit on command line length, it 's just that it is somewhat bigger than DOS's 127 characters)

      while you're at it, you probably want
      find -print0 | xargs -0 grep ... (to solve the problem with those nasty whitespace characters in filenames...)

    2. Re: zsh plug: Recursive file completion by gidds · · Score: 1

      Oh, yes, xargs is a much better solution than -exec, and I'd still use it for heavy-duty cases. But zsh's globbing is much simpler and more concise, and is just so handy!

      --

      Ceterum censeo subscriptionem esse delendam.

  32. what about ash? by 0xdeaddead · · Score: 1

    sniff..

  33. Some info by vivin · · Score: 1

    tcsh is a marked improvement over csh. csh is actually harmful. However my favourite is still bash. I might switch over to zsh though...

    --
    Vivin Suresh Paliath
    http://vivin.net

    I like
  34. also a good book-SCSH. by Anonymous Coward · · Score: 0

    Oh darn. No SCSH

  35. $20 at bookpool by Szplug · · Score: 2, Informative
    book at bookpool.com.

    Perhaps I'm evil, not supporting bn.com but, it's a massive difference in price - cheap enough to pick up casually.

    --
    Someday we'll all be negroes
  36. Try it yourself ;-) by codergeek42 · · Score: 2, Funny
  37. Obligatory Army of Darkness reference by bawdymonkey · · Score: 1

    He's in housewares....follow the sounds of shotgun fire :)

  38. IPython by ultrabot · · Score: 4, Interesting

    Those shopping for a shell, and with a taste for Python, would do well to check out ipython.

    In the 'pysh' mode, it acts as a fully functional system shell, even on Windows. Bash and friends suck on windows, but IPython truly shines there. It really makes the command prompt use of Windows feasible, with bash like filename completion etc. Being able to extend it with python functions (as opposed to separate scripts) is a killer feature as well.

    I've actually replaced the command prompt launchers on my KDE desktop with 'ipython -p pysh' launchers.

    --
    Save your wrists today - switch to Dvorak
  39. Topic icons by HishamMuhammad · · Score: 1

    Unix, Books, Linux, okay... But any idea why they added the Windows icon to this story?? Because those shells run under Cygwin? Wouldn't then at least make as much sense to put BSD and even Apple icons as well?

  40. bash? zshell? msh forever! by Jugalator · · Score: 1

    MSH, MSH, MSH!

    OK, seriously, it'll be interesting to see what comes out from Redmond there.
    I'm surprised that them working on a new shell hasn't spawned a ton of bad jokes about it already. ;-)

    --
    Beware: In C++, your friends can see your privates!
  41. No it doesn't? by /ASCII · · Score: 1

    I just tried to tab complete 'echo ?li' in a directory containing files like 'alias.c' and 'alias.h'. zsh did not find any completions.

    I tried using this both with the default completion and using the new 'compinit' completions. Nothing.

    Is there yet _another_ command you have to give to zsh in order to make it work the way it should by default?

    --
    Try out fish, the friendly interactive shell.
    1. Re:No it doesn't? by Mornelithe · · Score: 1

      Try:

      setopt globcomplete

      --

      I've come for the woman, and your head.

    2. Re:No it doesn't? by /ASCII · · Score: 1

      Great. Yet _another_ feature with _no_ drawbacks, that is still configurable, and off by default.

      --
      Try out fish, the friendly interactive shell.
    3. Re:No it doesn't? by /ASCII · · Score: 1

      But thank you for the information, anyway. It's not your fault zsh has insane defaults.

      --
      Try out fish, the friendly interactive shell.
    4. Re:No it doesn't? by Mornelithe · · Score: 1

      Actually, it does make some things different from how they were. For example:

      'ls *or*<TAB>'

      used to expand to the following in my home directory:

      'ls forwhomthebelltolls.mp3 homework'

      Now, it instead expands to

      'ls forwhomthebelltolls.mp3'

      And offers me a tab-list to switch between the two. So it completes globs now, but doesn't expand globs into multiple arguments (which I had gotten somewhat used to before). There's probably a way to set it up to do both, choosing as appropriate, but I'm not a guru.

      --

      I've come for the woman, and your head.

    5. Re:No it doesn't? by Mornelithe · · Score: 1
      Addendum:

      I figured out how to have the best of both worlds, so to speak. First of all, the effects of globcomplete can be had by adding the _match completion engine, so when I remove the globcomplete option, and set my completion engines thus:
      zstyle ':completion:*' completer _complete _match _prefix _list _history _expand _oldlist _ignored
      'ls *or*<TAB>'

      Expands to:

      'ls forwhomthebelltolls.mp3 homework'

      And:

      'ls *or<TAB>'

      Expands to:

      'ls forwhomthebelltolls.mp3'

      With a tab menu to select homework.

      The question is, how would you expect it to work out of the box? Granted, I do agree that doing nothing in the latter case is not correct.
      --

      I've come for the woman, and your head.

  42. ZSH rocks except for one feature by riflemann · · Score: 1

    I went back to bash after being totally unable to get zsh to remember the history between sessions. Bash is handy as I can log out, log back in, and up-arrow takes me back to my history from the previous session(s). I can't get zsh to do this. If someone can explain how, I'll go straight back to zsh again!

    1. Re:ZSH rocks except for one feature by opk · · Score: 2, Interesting
      All you should need is the following in your ~/.zshrc
      HISTFILE=~/.zshistory
      SAVEHIST=500
      HISTSIZE=500
      If that doesn't help let me know. Or mail zsh-users. I've never had a problem with it and it has always worked well.
      I also set these options:
      setopt EXTENDED_HISTORY
      setopt HIST_EXPIRE_DUPS_FIRST
      setopt HIST_FIND_NO_DUPS
      setopt HIST_REDUCE_BLANKS
      setopt HIST_SAVE_NO_DUPS
      setopt SHARE_HISTORY
      The last of those allows history so be shared between concurrently running shells.
    2. Re:ZSH rocks except for one feature by Just+Some+Guy · · Score: 1
      Isn't this:
      setopt HIST_EXPIRE_DUPS_FIRST setopt HIST_FIND_NO_DUPS setopt HIST_SAVE_NO_DUPS
      basically the same as:
      setopt HIST_IGNORE_ALL_DUPS
      ? If not, what's the difference?
      --
      Dewey, what part of this looks like authorities should be involved?
    3. Re:ZSH rocks except for one feature by opk · · Score: 1

      It's not quite the same. With HIST_IGNORE_ALL_DUPS, you'll never get duplicates in your history list ever. However, if you care about the order of commands in your history list then this can be annoying. This can be the case if you use csh bang history, fc to rerun a range of commands or, my favourite, the accept-line-and-down-history editor command (usually bound to Ctrl-O) which runs the command and then brings up the following command from the history.

      With the set of three options duplicates do go into the history list but they are removed first (before unique commands), some search functions won't find the duplicates and duplicates won't be saved between zsh sessions. That removes some of the negative impacts of duplicate commands.

      Page 136 of the book has a little bit more detail.

    4. Re:ZSH rocks except for one feature by Just+Some+Guy · · Score: 1

      Ahh, that makes sense. Thanks for the information (and for introducing my to ^O).

      --
      Dewey, what part of this looks like authorities should be involved?
  43. Re:ZSH rocks except for one misfeature by /ASCII · · Score: 2, Insightful

    I think this is a good illustration of one of the major problems with zsh. To get a decent history file with all the cool features, you have to add 9 different commands to you configuration file.

    To get a goob tab completion, with a good pager, etc, you need another boatload of commands. You will also want to redefine some keyboard shortcuts to more powerful versions of the same commands and install a few nifty add-ons.

    So suddenly you have spent a few hours creating a 100+ lines long configuration file just to enable some of the common zsh options. If dedicating your life to tweaking your shell sounds like fun, then go ahead. But most people have better things to do with their time.

    --
    Try out fish, the friendly interactive shell.
  44. dont be so lazy by edsonmedina · · Score: 1

    > So suddenly you have spent a few hours creating
    > a 100+ lines long configuration file just to
    > enable some of the common zsh options.

    Most modern distributions ship a decently configured zsh. In my case, an apt-get install zsh gives me a shell with a lot of tab completions (plenty more than bash), a pager as good as bash's (if not better), and so on...

    And for your information, bash also has a lot of configuration commands in the initialization scripts. AFAIK it doesnt do any magic "on its own".

  45. I prefer the windows command line. by ClioCJS · · Score: 1
    Get 4NT from http://www.jpsoft.com.


    Who needs Unix?

    --
    -Clio
    Karma: Bad (mostly from not giving a fuck)
    Blog: http://clintjcl.wordpress.com