Slashdot Mirror


BASH 4.0 Released

An anonymous reader writes "The widely used Bourne-Again Shell (BASH) version 4.0 is out. The new major release fixes several remaining bugs in the 3.x releases, and introduces a bunch of new features. The most notable new features are associative arrays, improvements to the programmable completion functionality, case-modifying word expansions, co-processes, support for the `**' special glob pattern, and additions to the shell syntax and redirections. The shell has been changed to be more rigorous about parsing commands inside command substitutions, fixing one piece of POSIX non-compliance. Most of us will probably wait for the distros to test the new version and upgrade gradually, but you always have the option of grabbing the source and compiling it yourself. Enjoy."

20 of 459 comments (clear)

  1. Zsh has had these features for years by urdak · · Score: 5, Informative

    I've been using Zsh (the Z shell) for years, because it had better completion, and a richer bourne-shell and ksh-based programming language including also associative arrays and the co-process.
    So it would appear that bash finally caught up. But zsh has continued to improve. I'll be sticking with zsh for now, until I see that bash really caught up.

  2. Re:So? by QuoteMstr · · Score: 4, Informative

    What the fuck are you talking about? In the real world, shell scripts are used all the time. Despite their failings relative to more complex languages like Python and Perl, shell scripts are very easy to generate from repeated manual invocations of command lines.

    In other words, to scratch an itch with a Python script requires writing your command over again. With a shell script, you can build on the commands you've already typed. Shell scripting is the original RAD, and remains very useful today.

  3. Re:Circular what? by Paralizer · · Score: 2, Informative

    It's commonly referred to as bootstrapping. For instance, you might bootstrap your compiler by using an older version to compile the newer version of that compiler.

  4. Re:So? by QuoteMstr · · Score: 2, Informative

    /etc/init.d/acpid: Bourne-Again shell script text executable
    /etc/init.d/btseed: Bourne-Again shell script text executable
    /etc/init.d/bttrack: Bourne-Again shell script text executable
    /etc/init.d/capi: Bourne-Again shell script text executable
    ...
    Err, what? Shell scripts are used all the time. Even upstart services are still often written as shell scripts. Really, why all the anti-shell hostility around here?

  5. Re:looks like it still loses history by Osso · · Score: 5, Informative

    are you looking for shopt -s histappend ?

  6. Re:So? by cheater512 · · Score: 3, Informative

    Gentoo uses bash for their init scripts citing reasons of speed.

    Yeah it does show.

  7. Re:patience by jetsci · · Score: 2, Informative

    Give me a K..DE!

    --
    Bored at work? Play Game!
  8. Re:looks like it still loses history by Froze · · Score: 4, Informative

    This almost works. I have tried using an approach like this by building bash scripts and modifying history variables.

    One issue is that sessions that don't terminate cleanly (ssh loss, system reboot, etc.) leave a bunch of dirty history files that would need to reaped at the next start up of a bash.

    --
    -- The morphemes of your disquisition are ascertainable, but they have eschewed an ambit of transpicuous exposition.
  9. Re:So? by MikeBabcock · · Score: 2, Informative

    I'm sorry, but /etc/rc.d/rc.sysinit is certainly not empty on my Fedora boxes. It also contains a lot of good functionality that matters to system start-up.

    --
    - Michael T. Babcock (Yes, I blog)
  10. Re:CORRECTION by multisync · · Score: 2, Informative

    ...MOST users.

    Judging by the number of Windows machines that are active members of botnets, it's not just the Linux desktop "MOST users" are not ready for.

    --
    I don't care why you're posting AC
  11. Re:looks like it still loses history by Anonymous Coward · · Score: 2, Informative

    That's only part of the solution. Yes, that will retain all recent commands but not in the order in which they were entered (instead, commands will be stored in the order in which the shells were closed).

    In order for history to be kept in chronological order, you need to
    $ set PROMPT_COMMAND='history -a'
    which I think is an ugly hack, but it ensures that the history file is appended (or rewritten, without histappend) each time the command prompt returns.

  12. Re:looks like it still loses history by threephaseboy · · Score: 4, Informative

    I did exactly as you said, and at the new login I had the commands from A,B,C (in that order) in history.
    Here's what it looks like:

      996  echo AAA # A
      997  history|tail # checking history on B
      998  echo BBB # B
      999  history|tail # checking history on C
    1000  history|tail # checking history on C, again
    1001  history |tail # new login

    This is:
    GNU bash, version 3.2.33(1)-release (x86_64-redhat-linux-gnu)

    --
    .
  13. Re:This is excellent news by morcego · · Score: 2, Informative

    I will give you the car, but not Word. Want it or not, they ARE operating a computer directly when using MS Word.

    --
    morcego
  14. Re:Ant-style ** globbing by againjj · · Score: 2, Informative
    So, http://www.mail-archive.com/cygwin@cygwin.com/msg94439.html states:

    There is a new shell option: `globstar'. When enabled, the globbing code treats `**' specially -- it matches all directories (and files within them, when appropriate) recursively.

    which would imply the buildings and cars go too. See also: http://www.bash-hackers.org/wiki/doku.php/bash4

  15. Re:csh syntax mode? by Random+Destruction · · Score: 2, Informative

    by typing csh, you're loading the c shell and leaving bash. Parent asked for compatibility mode.

    Hilarity ensues.

    As for why you should care which shell is which, you probably don't. You'd only care if you were using more advanced features or scripting. A quick google will show you all your shell can do. It's impressive, really.

    --
    :x
  16. Re:Screenshots? by kitgerrits · · Score: 3, Informative

    Warning, above post is NSFW!

    --
    "I was in love with a beautiful blonde once, dear. She drove me to drink. It's the one thing I am indebted to her for."
  17. Re:This is excellent news by fireman+sam · · Score: 5, Informative

    This is a placeholder for my reply to your comment. The comment itself has been written on paper using a disposable BIC ballpoint pen. The paper has been posted to the slashdot editors with instructions to replace this placeholder with the comment that is contained on the paper.

    A note to moderators. The comment I have written on the paper is both insightful and informative as well as funny. It would be impossible to consider the comment I have written to be overrated (even if it were rated +100), a troll, or flamebait. So please rate this placeholder accordingly.

    Thank you.

    --
    it is only after a long journey that you know the strength of the horse.
  18. Re:Bourne Shell by DarkOx · · Score: 2, Informative

    The Slackware standard for init scripts and other system utils done is shell is that it should run on ash. If it runs on ash it will run on bash. The installation media used to, and still does? use ash while an installed system uses bash as the interpreter. So I agree with you its reasonable to code to ash for shell scripts if portability to othe *NIX like systems or running in striped down cases like installation environments is any concern.

    --
    Repeal the 17th Amendment TODAY! Also Please Read http://www.gnu.org/philosophy/right-to-read.html
  19. Re:looks like it still loses history by x2A · · Score: 3, Informative

    or just add to your bashrc/profile scripts:
    shopt -s histappend

    --
    The revolution will not be televised... but it will have a page on Wikipedia
  20. Re:looks like it still loses history by x2A · · Score: 2, Informative

    I've said it in another post, but just to be helpful:
    shopt -s histappend
    add to your bashrc/profile scripts. Should do the trick for ya.

    --
    The revolution will not be televised... but it will have a page on Wikipedia