Substituting basename, dirname and ls commands
In Bourne shell, it is possible to use the following variable expansions as substitutes for the basename, dirname and ls commands
$ MYVAR=/path/to/basename $ echo ${MYVAR##*/} basename $ MYVAR=/path/to/dirname $ echo ${MYVAR%/*} /path/to $ echo * bin boot dev etc home lib lost+found mnt opt proc root sbin tmp usr var $
Hows That?