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."

50 of 459 comments (clear)

  1. This is excellent news by Anonymous Coward · · Score: 5, Funny

    Perhaps this year, Linux will be ready for the desktop.

    1. Re:This is excellent news by mrsteveman1 · · Score: 5, Funny

      No, but it'll be ready for the year of the commandline (comes right after year of the hippo).

    2. Re:This is excellent news by multisync · · Score: 5, Insightful

      Perhaps this year, Linux will be ready for the desktop.

      Linux has been ready for the desktop for years. It's just that certain users are not yet ready for Linux.

      --
      I don't care why you're posting AC
    3. Re:This is excellent news by Anonymous Coward · · Score: 4, Funny

      So... when can we expect the year of the L(inux)user?

    4. Re:This is excellent news by morcego · · Score: 5, Insightful

      Linux has been ready for the desktop for years. It's just that certain users are not yet ready for Linux.

      You are too kind. In fact, most users are not ready to operate computers. At all.

      --
      morcego
    5. 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.
  2. Re:csh syntax mode? by ichthus · · Score: 5, Funny

    Already there. Just type 'csh' and bash will enter csh-compatibility mode. For scripting, just replace your #!/bin/bash with #!/bin/csh and away you go.

    --
    sig: sauer
  3. looks like it still loses history by Froze · · Score: 5, Insightful

    Don't get me wrong, I really like bash, but the treatment of history is abysmal. The default behavior is to lose history due to a race condition when multiple bash sessions that are concurrently open are closed in arbitrary order.

    IMNSHO, the default of any process should be to never lose data.

    --
    -- The morphemes of your disquisition are ascertainable, but they have eschewed an ambit of transpicuous exposition.
    1. Re:looks like it still loses history by mea37 · · Score: 4, Insightful

      I'll grant I haven't thought this all the way through, but a slightly lighter-weight approach than daemons and databases might look like this:

      Each open session logs history to a uniquely-named file. Then on session close, that file can be appended to the one true history file. (A bit of file locking can maintain atomicity of the append step.)

      When you scroll back into history, you would start with your own session's still-open-and-separate history file -- which is more often than not what I'd expect, but not always what I get today. If you go back beyond the beginning of that, I supposed you'd scroll into the accumulated history of closed sessions.

      This means that one session doesn't "see" the history from a concurrent session while they're both open. That, too, can be addressed, even if it has to wait for a subsequetn release. Either way, it's better than just losing the data IMO.

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

      are you looking for shopt -s histappend ?

    3. 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.
    4. Re:looks like it still loses history by MikeBabcock · · Score: 5, Interesting

      Log in twice (A) and (B) as the same user, do something in session (A), then log out of (A).

      Now check 'history' as (B), obviously the first session's command isn't there.

      Open another session, (C) and check its history. It is just as you'd expect. Now type a simple command into session (B) and log out of it. What do you think the history is?

      Check history on (C) still logged-in. Log out of (C) and check history on a new login and you'll see that the history matches (C) inherited from (A), no record of (B) happening.

      --
      - Michael T. Babcock (Yes, I blog)
    5. Re:looks like it still loses history by wsanders · · Score: 4, Insightful

      Bah. History files are a horrible security problem. History belongs in memory. I can count on about ten hands the number of times I have found passwords and various other sensitive information in them.

      First line in my .bashrc files: unset HISTFILE

      --
      Give a man a fish and you have fed him for today. Teach a man to fish, and he'll say "WHERE'S MY FISH, YOU IDIOT?"
    6. 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)

      --
      .
  4. patience by Anonymous Coward · · Score: 5, Funny

    i'll wait for 4.2

    1. Re:patience by Tarlus · · Score: 4, Funny

      Give me a K..DE!

      You tried to say 'KDE' but there was a lag before it completed... Just like true KDE4!

      *Runs away*

      --
      /* No Comment */
  5. Re:Linux by Anonymous Coward · · Score: 5, Funny

    Still gay.

    Don't bash it dude.

  6. My Dr. Seuss observation... by drakaan · · Score: 4, Funny

    "...The most notable new features are associative arrays..."

    So now I can make a BASH hash, sweet!

    --
    "Murphy was an optimist" - O'Toole's commentary on Murphy's Law
  7. Re:Circular what? by Locklin · · Score: 4, Funny

    stay away from kernel.org then.

    --
    "Knowledge is the only instrument of production that is not subject to diminishing returns" -Journal of Political Econom
  8. 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.

    1. Re:Zsh has had these features for years by Hatta · · Score: 5, Funny

      Excellent post. I look forward to the ensuing flame war.

      --
      Give me Classic Slashdot or give me death!
    2. Re:Zsh has had these features for years by Just+Some+Guy · · Score: 4, Funny

      I also found the vi mode in zsh to be inferior to the equivalent in bash last time I tried it, but maybe it's improved since then.

      That's because Emacs's bindings are far more logical than Vi's, especially when running on FreeBSD instead of Linux. Oh, and indent with spaces.

      Did I miss anything?

      --
      Dewey, what part of this looks like authorities should be involved?
    3. Re:Zsh has had these features for years by 0xABADC0DA · · Score: 4, Interesting

      The reasons I use zsh and not bash:

      1) ... some pipeline | read variable

      In zsh you can use $variable to get the value. In base you have to do variable=$(... pipeline | { read variable; echo $variable; } ), and this is annoying and complicated when doing anything more than reading just one variable.

      2) tab completion doesn't have a cycle mode (like DOS's completion)

      abc-1.2.3
      abc-1.2.4
      abc-2.0.1
      abcdef

      In bash you have to do "a, tab, -, tab, 1, tab, 3" to get the first one. That means you have to know all the filenames so that you know what letter to press to get the next 'section' of the filename you want (you can double-tab to get a menu, but it's annoying). In zsh you can configure it to cycle, so to get the first one you type "a, tab" or the second one "a, tab, tab".

      3) rm -f -- $FILE

      In zsh, this does what you want, removing the files. In bash you have to say "$FILE" because if it has a space it is treated as two parameters, and also wildcard expanded. It's annoying to have 1/3 of the script be " characters.

      4) bash history has problem with multiple shells. It only writes the commands when the shell exists, so if it exits unexpectedly your history is lost. And if you open up another terminal you can't ctrl-r for recent commands in another window.

      5) zsh's line editor is better when editing multi-line commands and just generally readline is a pos. After having to use readline in a C program I have a huge bias against anything using it. It sounds like they improved it slightly by being able to remember the prompt text... before to erase the prompt and reshow it (in order to print async text) you had to remember the prompt index, delete the prompt text, save the prompt, clear the message, your code here, then restore the prompt, undo the delete of the text, restore the prompt index (by setting a global variable), then redisplay the prompt, then set the prompt string. Oh, and each one of these functions is just poorly documented enough that you feel like it might possibly tell you what you need to know, then you find out the time you spent figuring out how to navigate an 'info' file (again) was completely wasted.

  9. Screenshots? by dsginter · · Score: 5, Funny

    Does anyone have any screenshots? I always hate that when they post some great new upgrade without any screenshots.

    --
    More
    1. Re:Screenshots? by NonUniqueNickname · · Score: 5, Funny
      Here are a couple of screen shots. First one running as regular user. Second one running as root.

      $

      #

    2. Re:Screenshots? by lawaetf1 · · Score: 4, Funny

      Here you go..

      [root@localhost ~]#

      --
      CommentBot 0.7a running with args "-module irritate,disagree -target random"
    3. Re:Screenshots? by MikeBabcock · · Score: 4, Funny

      I was really hoping someone would post a picture of a half-rotated Compiz cube with a bash shell running transparently on it.

      --
      - Michael T. Babcock (Yes, I blog)
    4. Re:Screenshots? by MMC+Monster · · Score: 4, Funny

      Anyone have a high-res screen shot? My fonts are raster based. :-(

      --
      Help! I'm a slashdot refugee.
    5. Re:Screenshots? by dmsuperman · · Score: 4, Funny
      --
      :(){ :|:& };: Go!
  10. Re:So? by brasspen · · Score: 4, Insightful

    The day Ruby or Python takes over from the boot grub loader for the initialization of init levels in Linux on start up is the day your statement makes sense. Until then, I think people with your attitude love one tool too much. If you don't understand BASH, you don't really understand Linux. I think OS start up is a serious script.

  11. Note for sysadmins by 93+Escort+Wagon · · Score: 4, Funny

    With your production boxes, it's generally recommended that you wait for Bash 4.0 SP1 before deploying.

    --
    #DeleteChrome
  12. Re:Circular what? by slim · · Score: 5, Insightful

    What do you think was used to compile GCC?

  13. 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.

  14. Re:csh syntax mode? by Doug+Neal · · Score: 5, Funny

    This is great, but I find the csh syntax easier to use from the command line (however unsafe it is to use in scripts). Will they add a csh compatability mode to bash?

    ln -s /bin/false /bin/csh

    99% of the functionality of csh, without the bugs!

  15. Re:Circular what? by Hatta · · Score: 5, Funny

    Sup dawg, I heard you liked compiling, so I put a compiler in your compiler so you can compile while you compile.

    --
    Give me Classic Slashdot or give me death!
  16. Re:After bootstrapping... by QuoteMstr · · Score: 4, Interesting

    Broken link. Try this: Reflections on Trusting Trust. It's the most frightening security paper of the last 30 years.

  17. Re:Circular what? by fulldecent · · Score: 5, Funny

    Your mom?

    --

    -- I was raised on the command line, bitch

  18. Re:Bourne Shell by TheRaven64 · · Score: 4, Insightful

    Not available? Not many. Not installed as standard? *BSD, Solaris, AIX, and any Linux that isn't GNU/Linux. POSIX mandates the existence of /bin/sh and a set of commands it must understand. Any POSIX system will have this, and it's possible to write complex scripts using only these features. Using bash extensions means that you are writing a GNU shell script, not a portable shell script. This may be fine for you, but you've just added another dependency to your program.

    --
    I am TheRaven on Soylent News
  19. Re:So? by zx-15 · · Score: 4, Interesting

    Weird, because Debian moving away from bash to dash for exactly the same reasons.
    http://www.nabble.com/Making-init-scripts-use-dash-td4458217.html

  20. Re:Circular what? by SatiricComet · · Score: 5, Funny

    Visual Studio 2008?

  21. Ant-style ** globbing by Rayban · · Score: 4, Funny

    Instead of rm -rf /, we can now just say

    rm -f /**

    Now that's an improvement!

    --
    æeee!
    1. Re:Ant-style ** globbing by gzipped_tar · · Score: 4, Interesting

      The scary thing "rm -f /**", when used with the new shopt "globstar", removes all non-directory files while preserving the directory skeleton. It's kinda like vaporizing everyone in the town while leaving all the empty buildings and cars intact...

      --
      Colorless green Cthulhu waits dreaming furiously.
    2. Re:Ant-style ** globbing by WhitefishMT · · Score: 5, Funny

      So they've finally perfected the Gnu-tron bomb!

  22. I hate [T]CSH by Khopesh · · Score: 5, Insightful

    One of my favorite bookmarks, Csh Programming is Considered Harmful, is very useful for shell scripting in Bourne, Csh, and Bash. Oh, and it's also a good reminder of why you should never write csh scripts.

    In my experience, the only [t]csh users out there are those who used it back in the day before there were other options, or those who are so embedded in the C/C++ world that they thought it a good idea to use a C/C++ -styled shell. That's fine, use that shell. DON'T write scripts in it though. It's annoying. (More annoying: ln -s /bin/csh /bin/sh ... this breaks TONS of things as /bin/sh must be posix-compliant. Csh doesn't even want (or try) to do that!)

    --
    Use my userscript to add story images to Slashdot. There's no going back.
  23. Re:something resembling homepage by Tweenk · · Score: 5, Funny

    Are you smoking something? This is a GNU project. The "web page" is actually a facade to appease the unenlightened. Here is a Web 1.0 concept mapping for you:

    news page -> "announce" mailing list
    wiki -> "user" mailing list, documentation
    developer forum -> "dev" mailing list
    release notes -> in the tarball!

    --
    Those who would give up liberty to obtain working drivers, deserve neither liberty nor working drivers.
  24. Re:Circular what? by Ant+P. · · Score: 4, Funny

    EGCS, duh.

  25. Yes!!! by commodoresloat · · Score: 5, Funny

    This is definitely the turning point; the Register just last week published an article indicating that the one thing stopping most users from migrating from Windows was the lack of support for the `**' special glob pattern.

  26. Re:CORRECTION by Jurily · · Score: 4, Insightful

    ...MOST users.

    To be fair, most users have trouble setting the clock on a VCR.

  27. Re:csh syntax mode? by Random+BedHead+Ed · · Score: 4, Funny

    WHOOOSH

    I was following this discussion of bash, sh, csh and tcsh perfectly well, but now I'm lost. What shell are you talking about?

  28. Ah, a friend of mine LOVES you by SmallFurryCreature · · Score: 4, Insightful

    He has a garage, fixes cars. He LOVES people that don't think they need to operate their car. Some lovely person puts petrol in the company van, ah christmas come early! Oil light been on since "Oh I just ignore that as the car starts fine with it on", we will eat tonight!

    The simple fact is that we got to know a lot of stuff and if we don't we pay other people a LOT of money for knowing their stuff. 175 euro for 15 minutes work unglogging a toilet because some female doesn't know you can't put femine hygiene products down the toilet.

    50 euro to run a set of automated tools on your PC to clean it, total labor involved, inserting a USB stick, you got to bring the PC in, during quiet hours and pick it up yourself, no warranty.

    My neighbour changed his the nature of his small construction firm, he no longer does projects for clients, he assists DIY'ers with theirs. To translate, he charges a FORTUNE to fix the mess they made and has their free labor to help out with simple but expensive to hire a pro for tasks.

    Everytime somebody like you defends people not having to know the tools they use, somebody somewhere sees dollar signs.

    --

    MMO Quests are like orgasms:

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