zsh is for vulcans. ;-)
Seriously:
bash 4.0 has some features previously only found in zsh, like ** globbing:
% ls /usr/src/**/Makefile
is equivalent to:
% find /usr/src -name "Makefile"
but obviously more powerful.
In my experience bash's programmable completion performs a bit better than zsh's, at least for some cases (completing debian packages for aptitude for example).
bash has Alt + .
to insert !$
zsh has expansion of all variables, so you can use e.g.
% rm !$<Tab>
for this. zsh can also expand a command in backtics, so
% cat `echo blubb | sed 's/u/a/'`<Tab>
yields
% cat blabb
I find it very useful to expand rm *
, as you can see what would be removed and can maybe remove one or two files from the commmand to prevent them from being deleted.
Also nice: using the output from commands for other commands that do not read from stdin but expect a filename:
% diff <(sort foo) <(sort bar)
From what I read bash-completion also supports completing remote filenames over ssh if you use ssh-agent, which used to be a good reason to switch to zsh.
Aliases in zsh can be defined to work on the whole line instead of just at the beginning:
% alias -g ...="../.."
% cd ...
According to man bash
:
PS1 is set and $- includes i if bash is interactive, allowing
a shell script or a startup file to test this state.
So you can use:
if [[ $- == *i* ]]
then
do_interactive_stuff
fi
Also:
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist.
So ~/.bashrc
is only sourced for interactive shells. Sometimes, people source it from ~/.bash_profile
or ~/.profile
which is incorrect since it interferes with the expected behavior. If you want to simplify maintenance of code that is common, you should use a separate file to contain the common code and source it independently from both rc files.
It's best if there's no output to stdout from login rc
files such as ~/.bash_profile
or ~/.profile
since it can interfere with the proper operation of rsync
for example.
In any case, it's still a good idea to test for interactivity since incorrect configuration may exist.
Best Answer
But I wonder if you need it removed checking for the existence package/file is needed ?