Attributes on expansions and params. Using default values: $ sh -c "echo \${FOOBAR-hello}" hello $ msh -c "echo \${FOOBAR-hello}" hello Smallest prefix pattern: $ cat > test.sh << EOF > x="foobar" > echo "\${x#foo}" > echo "\${x#f*}" > echo "\${x#bar}" > EOF $ sh test.sh bar oobar foobar $ msh test.sh bar oobar foobar Largest Prefix Pattern: $ cat > test.sh << EOF > x=/path/to/my/script.sh > echo "\${x##*/}" > EOF $ sh test.sh script.sh $ msh test.sh script.sh Smallest suffix pattern: $ cat > test.sh << EOF > x="foobar" > echo "\${x%bar}" > echo "\${x%o*}" > echo "\${x%foo}" > EOF $ sh test.sh foo fo foobar $ msh test.sh foo fo foobar Largest suffix pattern: $ cat > test.sh << EOF > x=/path/to/my/script.sh > echo "\${x%%*/}" > EOF $ sh test.sh /path/to/my/script.sh $ msh test.sh /path/to/my/script.sh Length of param: $ cat > test.sh < foo=hello > echo \${#foo} > EOF $ sh test.sh 5 $ msh test.sh 5 Assigning on the fly: $ cat > test.sh << EOF > echo \${FOO:=bar} > echo \$FOO > EOF $ sh test.sh bar bar $ msh test.sh bar bar