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