Sun
31
Dec '06
Bash shell goodies
by Frank Spychalski filed under Computer

I stumbled over three very handy shell variables CDPATH, HISTCONTROL and HISTIGNORE.

  • CDPATH takes (just like PATH) a list of directories to use for tab-completion for cd, e.g. export CDPATH=".:~/:~/work/:~/download/" gives me a tab completion for the current (don’t forget this one!), my home, my word and my download directory.
  • HISTCONTROL can be set to ignorespace, ignoredups or ignoreboth. The first ignores lines starting with a space (I’m not sure, why this is useful :-) ) but the second causes bash to ignore duplicates. The last one turns turns both options on.
  • HISTIGNORE takes a list of patterns for commands which should not be saved, e.g. export HISTIGNORE="rm *:cd *:[a-z][a-z]" ignores rm and cd with any parameter and every 2 letter command.

Related entries:


One Response to “Bash shell goodies”

  1. 1

    [...] Bash shell goodies [...]

Any comments? Or questions? Just leave a Reply:

Bad Behavior has blocked 356 access attempts in the last 7 days.