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 Tip: Alternative to expr for arithmetic

I discovered recently a neat way to do arithmetic in BASH without the need to use the expr command. There's a build-in that uses the syntax $((…)) or $[ … ]. This is also faster as it avoids the need to invoke a separate command. See: http://snap.nlc.dcccd.edu for more on…

BASH: Open FileMerge from CLI

Here's a quick tip. If you want to open FileMerge (Apples graphical diff utility available in developer tools) from the CLI you can use the command opendiff e.g: opendiff file1 file2 This save lots of hassle when you are trying to resolve versioning conflicts, as I always find it…

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…