Bash cheatsheet
From Lolly's Wiki
Nützliche Variablenersetzungen
dirname
$ myself=/usr/bin/blafasel ; echo ${myself%/*} /usr/bin
basename
$ myself=/usr/bin/blafasel ; echo ${myself##*/} blafasel
$ myself=/usr/bin/blafasel ; echo ${myself%/*} /usr/bin
$ myself=/usr/bin/blafasel ; echo ${myself##*/} blafasel