Navigation:

Search



Our Friends

Articles Cool Shell Tricks
 

Cool Shell Tricks

Cool things you can do in shell (like bash)

This was written by Everyone! and given on Wed Nov 9 2005.

Table of Contents


1. Cool Shell Tricks
shopt -s cdspell "minor errors in the spelling of a directory component in a cd command will be corrected"
pushd/popd/dirs "Directory stacks"
binary <<< here docs "single line here docs"
!foo "repeat last command that started with foo"
^find^replace^ "repeat last command, but replace find with replace"
${!tmp_var} "Indirect reference to the contents of the variable whose name is in tmp_var"
shopt -s nullglob "Expand failed globs to null"
something with IFS "IFS is the input field separator"
OPTION=${OPTION:-"default"} "Default values in variable expansions."
[[ expr ]] "Double-bracket: Do what I mean!"
(if in zsh)
cd build/arch1/foo
cd arch1 arch2
"will search and replace on current directory then switch to new directory"