Follow Slashdot stories on Twitter


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 internet speed test! ×
Upgrades Software Linux

BASH 4.0 Released 459

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."
This discussion has been archived. No new comments can be posted.

BASH 4.0 Released

Comments Filter:
  • by Anonymous Coward on Monday February 23, 2009 @04:49PM (#26961587)

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

    • by mrsteveman1 ( 1010381 ) on Monday February 23, 2009 @05:09PM (#26961849)

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

    • by multisync ( 218450 ) on Monday February 23, 2009 @05:13PM (#26961907) Journal

      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.

      • by Anonymous Coward on Monday February 23, 2009 @05:29PM (#26962139)

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

      • by morcego ( 260031 ) on Monday February 23, 2009 @05:54PM (#26962465)

        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.

        • Re: (Score:3, Insightful)

          by DiegoBravo ( 324012 )

          Most people don't need to operate computers directly. But a lot of people uses them more or less indirectly, for example, when driving a modern car, or when redacting a letter in MS Word. The idea is that people should never have to be ready for (nor aware of) any OS at all.

          • Re: (Score:3, Informative)

            by morcego ( 260031 )

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

          • by SmallFurryCreature ( 593017 ) on Tuesday February 24, 2009 @03:19AM (#26966615) Journal

            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.

        • Re: (Score:3, Funny)

          by thefekete ( 1080115 )

          In fact, most users are not ready to operate computers, et al.

          Fixed it for you...

      • Re: (Score:3, Insightful)

        by moosesocks ( 264553 )

        It's gotten a lot better, but there are still gaps that need to be filled in.

        Today, I had to enable printer sharing (via Samba for Windows clients) on my parents' computer, which is running Ubuntu.

        Although the majority of the desktop is very well-integrated, the process for doing this was *extremely* non-obvious.

    • Yes!!! (Score:5, Funny)

      by commodoresloat ( 172735 ) on Monday February 23, 2009 @06:48PM (#26963107)

      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.

  • by Froze ( 398171 ) on Monday February 23, 2009 @04:52PM (#26961629) Homepage

    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.

    • by Osso ( 840513 ) on Monday February 23, 2009 @05:15PM (#26961927)
      are you looking for shopt -s histappend ?
    • by wsanders ( 114993 ) on Monday February 23, 2009 @06:35PM (#26962971) Homepage

      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

    • Re: (Score:3, Interesting)

      Don't get me wrong, I really like bash, but the treatment of history is abysmal.

      I guess that I must be weird or something. I don't expect bash to retain history from one invocation to the next, and I'm always surprised when it happens.

  • patience (Score:5, Funny)

    by Anonymous Coward on Monday February 23, 2009 @04:52PM (#26961631)

    i'll wait for 4.2

  • So, I'm gonna grab the source to BASH and compile it using GCC under BASH? My brain hurts :).
  • Bugs (Score:3, Funny)

    by microbee ( 682094 ) on Monday February 23, 2009 @04:56PM (#26961675)

    The new major release fixes several remaining bugs in the 3.x releases

    That's great, but they forgot to mention how many new bugs were introduced.

  • by drakaan ( 688386 ) on Monday February 23, 2009 @04:58PM (#26961707) Homepage Journal

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

    So now I can make a BASH hash, sweet!

  • by urdak ( 457938 ) on Monday February 23, 2009 @05:01PM (#26961745)

    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.

    • Re: (Score:3, Funny)

      by Curate ( 783077 )
      Please, no more GNU bashing.
    • by Hatta ( 162192 ) on Monday February 23, 2009 @05:30PM (#26962153) Journal

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

    • by 0xABADC0DA ( 867955 ) on Monday February 23, 2009 @07:35PM (#26963597)

      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)


      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.

  • by dsginter ( 104154 ) on Monday February 23, 2009 @05:01PM (#26961747)

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

  • by 93 Escort Wagon ( 326346 ) on Monday February 23, 2009 @05:03PM (#26961773)

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

  • Bourne Shell (Score:3, Insightful)

    by russotto ( 537200 ) on Monday February 23, 2009 @05:07PM (#26961827) Journal

    If you want your scripts to be compatible with just about every Unix, you still need to stick with /bin/sh (yes, I know, it's a compatibility mode). If you don't, might as well use a better scripting language.

    • Re: (Score:3, Interesting)

      by Deagol ( 323173 )

      Apparently, bash's own compatibility mode leaves a lot to be desired. There's no end to people on FreeBSD lists who bitch about porting some script from Linux, to have someone point out that /bin/sh on Linux 99.9% of the time equals /bin/bash in compatibility mode. Best to code for strict Bourne shell syntax even if you use Linux, since you can be reasonably assured that it will work nicely on other systems. Not sure what the de-facto open source Bourne shell clone is. Perhaps "ash" is close enough, as

      • Re: (Score:3, Informative)

        by DarkOx ( 621550 )

        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.

    • Re: (Score:3, Interesting)

      by r7 ( 409657 )

      use a better scripting language

      That's what I've been wondering. Bash is fine for the command-line but not such a good choice for scripts due to compatibility issues. It certainly isn't a good choice of scripting language compared to /bin/sh. Given the number of changes bash has had over the years it would seem to be a kitchen sink of every feature anyone wanted to add (though not necessarily use). POSIX is protecting /bin/sh from this sort of feature creep but there are still several bugs in "bash --posix" (sh mode).

      I also wonder abo

  • by richlv ( 778496 ) on Monday February 23, 2009 @05:38PM (#26962249)

    it would be quite cool if they could set up at least something something resembling homepage.
    you know, the thing with announcements, news, and, ooooh, release notes !
    wiki probably would be too much to ask.

  • by Rayban ( 13436 ) * on Monday February 23, 2009 @06:00PM (#26962543) Homepage

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

    rm -f /**

    Now that's an improvement!

  • by RichiP ( 18379 ) on Monday February 23, 2009 @06:17PM (#26962729) Homepage

    I'm seeing release candidate versions of bash 4 in the SRPMS dir for Fedora testing. It should be easy to rebuild it on Fedora 10 and install it, but I'd like to know if it would break existing scripts.

    Does anyone know if it has any backward compatibility issues?

  • Freedom at a price (Score:4, Interesting)

    by Yfrwlf ( 998822 ) on Tuesday February 24, 2009 @03:25AM (#26966653)
    "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."

    Translation: "Most of us would try it out if only it was easy to do so and we had the freedom to easily install and use Linux software, but we don't, because software installation standards have yet to be worked out and right now it's annoying as hell tracking down the dependencies manually and struggling through the compilation process. Instead, we'll rely on distro companies to give us access to software instead of being able to download and run like Mac and Windows users have the luxury of doing."

    Yeah, I'm sure I'll hear the "if they want to try out BASH then they probably know how to compile already" argument, but a) that doesn't make it any less annoying, just because you like using the command line doesn't mean you hate convenience, and b) I'm speaking generally about the sever lack of Linux binaries in existence, and the complete lack of nice installation packages unless you get lucky and someone targeted your specific version of your specific distro.

    Once Linux application installation becomes a snap, so any Linux users can easily share software, you will see a much greater proliferation of Linux programs out there, torrents etc, because it will actually be useful keeping archives of packages because they won't go obsolete in 6 months. Once users can easily share Linux programs, it will help make Linux adoption sore and Linux users who don't want to or don't know how to compile will finally be free of suckling on distro companies for their software milk.

May Euell Gibbons eat your only copy of the manual!