problem is that ${param:-word} already has a well-defined meaning: expand to word if the expanded valu... xpr substr $stringZ 4 3` # ABC
===== Default =====
These operators can be used in a variety of ways. A good example would be to give a default value to a variable normally read from the c... table:
Operator Function Example
${foo#t*is} Deletes the shortest possible match from the left e
# If a string has not been initialized, it has no defined value.
# This state is called "null" (not th... !).
if [ -n $string1 ] # string1 has not been declared or initialized.
then
echo "String \"strin... his works fine.
# The [ ... ] test operator alone detects whether the string is null.
# However it is ... ses the 'more' filter.
# May substitute 'less' if desired.
exit $? # Script returns exit status of