${param:-default} If param is null, then set it to the value of default .
${#param} Gives the length of param
${param%word} From the end, removes the smallest part of param that
matches word and returns the rest
${param%%word} From the end, removes the longest part of param that
matches word and returns the rest
${param#word} From the beginning, removes the smallest part of param that
matches word and returns the rest
${param##word} From the beginning, removes the longest part of param that
matches word and returns the rest
=========================================================
unset foo
echo ${foo:-bar}
output:bar
-----------------------------------
foo=fudecho ${foo:-bar}
output:fud
--------------------------------------
foo=/usr/bin/X11/startxecho ${foo#*/}
echo ${foo##*/}
output: usr/bin/X11/startx
startx
--------------------------------------------
bar=/usr/local/etc/local/networks
echo ${bar%local*}echo ${bar%%local*}
output: /usr/local/etc
/usr