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."
i think you mean sh, /bin/sh is a symlink to bash in most all Linux systems, calling bash from the sh symlink: Man page ahead::
/etc/profile and ~/.profile, in that order. The --noprofile option may be used to
inhibit this behavior. When invoked as an interactive shell with the name sh, bash
looks for the variable ENV, expands its value if it is defined, and uses the
expanded value as the name of a file to read and execute. Since a shell invoked as
sh does not attempt to read and execute commands from any other startup files, the
--rcfile option has no effect. A non-interactive shell invoked with the name sh
does not attempt to read any other startup files. When invoked as sh, bash enters
posix mode after the startup files are read.
/bin/csh is usually a symlink to /bin/tcsh in most all Linux systems.
If bash is invoked with the name sh, it tries to mimic the startup behavior of his- torical versions of sh as closely as possible, while conforming to the POSIX stan- dard as well. When invoked as an interactive login shell, or a non-interactive shell with the --login option, it first attempts to read and execute commands from
Politics is Treachery, Religion is Brainwashing
Broken link. Try this: Reflections on Trusting Trust. It's the most frightening security paper of the last 30 years.
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)
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
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.
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?
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.
Or do "set -o inc_append_history" in zsh.
(I'm not sure if the option is case sensitive. It may need to be in CAPS, the lameness filter made me change it)
We hope your rules and wisdom choke you / Now we are one in everlasting peace
"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.
Promote true freedom - support standards and interoperability.