Next: , Previous: Parentheses, Up: Portable Shell


10.8 Slashes in Shell Scripts

Unpatched Tru64 5.1 sh omits the last slash of command-line arguments that contain two trailing slashes:

     $ echo / // /// //// .// //.
     / / // /// ./ //.
     $ x=//
     $ eval "echo \$x"
     /
     $ set -x
     $ echo abc | tr -t ab //
     + echo abc
     + tr -t ab /
     /bc

Unpatched Tru64 4.0 sh adds a slash after `"$var"' if the variable is empty and the second double-quote is followed by a word that begins and ends with slash:

     $ sh -xc 'p=; echo "$p"/ouch/'
     p=
     + echo //ouch/
     //ouch/

However, our understanding is that patches are available, so perhaps it's not worth worrying about working around these horrendous bugs.