Slashdot Mirror


Which Shell Do You Prefer?

Pascal de Bruijn asks: "I recently started to use NetBSD, the first thing I noticed was that it didn't have a command-line history. So I immediately wanted to switch my shell, being on BSD my first instinct was to change to tcsh, but many people told me it wasn't any good. Others recommended zsh. I would really like to hear your opinions about shells." The submitter is particularly interested in shell memory usage, and the features you like...and dislike...from the current options that are available, today.

11 of 138 comments (clear)

  1. Shells aren't for scripting. by mellon · · Score: 4, Interesting

    We use bash/bourne shell for scripting because it's available on every operating system, and its behavior is reasonably predictable. It would be insane to write a shell script in tcsh, for example (not that I haven't done it... :').

    However, if you really want to write a quick script, something like Perl or Python is a better choice, unless you really need that portability. And if you really want a nice UI, well, you should use what works for you.

    On that basis, I use tcsh. it is not superior to bash - if anything, bash is, taken as a whole, superior to tcsh. Likewise ksh. But I'm not using all the features of ksh or bash, and because of my own personal history - what I imprinted on - I find tcsh much more predictable. Its behavior is also more similar to emacs' behavior than bash's behavior, and I use emacs. So for me, tcsh is the right choice.

    You said you use tcsh elsewhere. So to some degree you've probably imprinted on it. It's brave of you to decide to check out the competition, but it's going to come down to a matter of personal preference, so my advice to you is to personally check out the competition - don't take our word for it. This is a productivity tool, so pick the one that works nicely for *you*.

    Having said that, the obvious competition to tcsh is bash, and it's getting to the point where it's pretty much ubiquitous, so that is what I'd suggest you check out. Switch to bash for a month. Try to customize it to your liking. After a month, switch back to tcsh. If you find yourself missing bash, switch back to bash. If you find yourself happy and relieved to be back home, stick with tcsh. If you find yourself still on the fence, use bash, because it's more likely to be installed on random machines that you log into (into which you log?).

    1. Re:Shells aren't for scripting. by Quixotic+Raindrop · · Score: 2, Interesting

      [...] because it's more likely to be installed on random machines that you log into (into which you log?)

      "into which you login" would be best, I think :)

      I've been a *BSD & Linux user for many a year now, and I was first introduced to tcsh. The Sun OS 5.4 machine that I first logged into had csh, IIRC, and after a while of back & forth between Sun OS 5.4 and BSDI on the school machines, I settled on using tcsh. I find bash to be annoying from time to time, but like many others here I don't do shell scripting. I always use Perl. It just seems to be a cleaner solution. Maybe I'm weird.

      --
      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Einstein)
  2. Re:Bash is the One True Shell, ksh is very close by 0x0d0a · · Score: 2, Interesting

    Not bad, but here are my own feelings.

    I've never even used sh (just bash...)

    csh/tcsh are significantly less popular than the others -- their main users are BSD fans.

    zsh is relatively heavyweight, but I really like it. If there's a feature, zsh has it. I particularly like colorized tab completion. It's got a lot of bash and ksh's features combined. It's true that it's less common than bash.

    bash is the most common, easily. It's a pretty safe choice.

    I haven't been too impressed with other shells. perl shell isn't that great for actual use, the Plan 9 shells like rc lack job control.

  3. Korn shell by Cuchullain · · Score: 3, Interesting

    Korn is a great shell, and he is constantly working on it, so it is getting better and better.

    It is the shell I find most often on the commercial boxen that I need to work with, so I use it on linux and freebsd too. I'm certain that there is a version available for netbsd too. pdksh is a distant second to the real thing, so go grab the official ksh! It isn't pure from an open source viewpoint, but I am answering in terms of practicality not idealism.

    You can grab it from att labs' page if I remember correctly. It is the gold standard for 'correct' behavior as far as I am concerned, and is what you will find on a whole slew of different *nix boxes.

    I try to avoid bash, because though it is a really nice shell, I never find it on commercial systems, and I want my shell to behave consistently wherever I am.

    Cuchullain

    --
    "If sharing a thing in no way diminishes it, it is not rightly owned if it is not shared." -St. Augustine
  4. Re:Bash is the One True Shell, ksh is very close by keramida · · Score: 3, Interesting
    No one said the shell you use has to be the one you program in. I prefer to use tcsh for my interactive shell (it does everything that I need it to), but use sh for shell scripting (since it's on every platform I work on).

    True, true. There are times though that one has to type on the prompt things like:

    $ for fname in $( cmd | sed | awk | grep ) ; do \
    stuff "${fname}" ; done

    The scriptability of the shell right there on the command prompt, is probably the only reason I use bash as my login shell even on BSDs.

    --

    --
    My other computer runs FreeBSD too.
  5. non-nix shells by kfx · · Score: 2, Interesting

    Granted, this topic is geared towards nix shells, but when you're stuck with windows no shell comes close to rivaling the power and flexibility of LiteStep.

  6. zsh is the supreme power user's shell by mbogosian · · Score: 4, Interesting

    csh/tcsh...

    I'm really disappointed that this is the default shell in OS X. Using tcsh is downright painful for anyone used to real tab-completion (e.g., zsh, bash).

    zsh - From what I've read, a good shell, but very nonstandard. Do you really want to lug a shell around and install it (and set up /etc/shells or whatever each time, etc.) for every machine you log into? ...

    bash - I think bash is a little better than ksh...


    If you're a bash user for the interactive benefits (i.e., tab completion, etc.), then you should really consider converting to zsh. It will take you a day, but you'll be glad you spent the time and you'll never go back (unless you're forced to, in which case it will be painful).

    Aside from the "embrace and extend" approach of these shells that a previous poster mentioned, zsh wins by a light year compared to anything else, especially with its tab completion libraries (imagine being able to hit TAB after typing cvs to get a list of the subcommands). Not only that, but zsh history/command-line editing are far superior (with a true emacs-style kill ring and real multi-line command editing). The learning curve can be steep, but there are plenty of tutorials out there to get you started. zsh is the power user's shell of choice if you spend any time in the shell (this is coming from a six-year bash zealot).

  7. Re:Python script by Meowing · · Score: 2, Interesting

    Even though Python has a fairly nice interactive mode, it makes for a really lousy general purpose shell. You certainly can create processes, plumb them together, redirect their stdio and all that, but not in the concise manner one expects from a CLI. People have tried to write shells around Perl, Python and similar languages, but these things tend to fail in the usability department, which is why hardly anyone actually uses them. Possibly such a thing could be written and not suck, but it hasn't happened yet.

  8. Re:That's easy... by mirabilos · · Score: 2, Interesting

    You basically use the /bin/ksh Korn Shell because it
    is part of the base system. It's the pdksh, not the
    ast-ksh, and it has basically every feature from GNU
    bash you would need (except man page and password
    auto-completion *g*). And it's free as in BSD licence.

    On GNU/Linux, where I usually have the choice between
    GNU bash and tcsh, I prefer bash (until I get to install
    pdksh) because it's a bourne shell (well, more or less).

    On BSD, however, I urge you to not install GNU bash,
    especially not as the root shell, because:
    - if you get used to it, it's harder to use other shells,
    e.g. if you're at anyone else's system
    - it's dynamically linked and resides in /usr/local/bin,
    whereas /bin/ksh and /bin/csh are statically linked
    (system rescue issues)
    - especially for root, I'd stick with the shells the system
    provides (security issues)

    So I think /bin/ksh fits you just fine.

    --
    My Karma isn't excellent, damn it! (And /. still does not get UTF-8 right in 2012. Wow.)
  9. Csh programming NO LONGER harmful by bluestar · · Score: 2, Interesting

    Yeah, I read the article. It's from 1996 people. 6.5 years ago. Move on.

    Besides the article is horribly written. It takes him three pages to say "redirecting file descriptors is inferior to sh". Another page to say "quoting sucks". The rest is either petty or doesn't exist in tcsh.

    And he can't decide if he doesn't like csh as a login shell or as a scripting language or both.

    I admit to writing scripts in csh instead of bash. In reality both suck. If I need something so complex I need functions I am NOT using bash or csh.

    Bash and csh as programming languages suck when compared to C, C++, Java, Perl, Python and LISP. But I'm not about to make emacs my login shell (again).

    My login shell is tcsh. There are things I hate about bash/readline. YMMV. Use the right tool for the job. Not available in Tennessee.

    --
    "The cost of freedom is eternal vigilance." -Thomas Jefferson
  10. why I use csh instead of sh... by Jamie+Zawinski · · Score: 3, Interesting

    I never write scripts in csh (I use perl or sh) but I still use csh as my interactive shell, because (aside from trivially launching programs) the most common thing I use any of the actual syntax of the shell for is pounding out stuff like:

    • foreach f ( *.jpg )
      djpeg $f | pnmscale ... | cjpeg > $f:r-thumb.jpg
      end

    sh/bash don't support the $var:r and related syntaxes, and so it's a lot more typing to do:

    • for f in *.jpg ; do
      djpeg $f | pnmscale ... | cjpeg > \
      `echo $f | sed 's/\..*/-thumb.jpg/'`
      end