Using 'select' for multiple choices in shell scripts

I found this neat construct in the gnu bash reference. Select is a great way to be able to present a list of options to a user in a shell script. Take the example given in the reference: select fname in *; do echo you picked $fname \($REPLY\) break; done This…

Showing last two directories of pwd in BASH prompt

I'm working on a project where we are using Bazaar downstream of CVS and we have several common Bazaar branches for keeping up to date with CVS. The problem with this is that you can be in the first directory of the branch who's name is exactly the same another…

BASH: Single-quotes inside of single-quoted strings

Using single quotes in BASH ensures that the shell doesn't expand the contents of the quoted string and this is useful most of the time. However if you want to use single quotes within a single quoted string things don't work out as you might expect. For example using the…