Use printf instead of echo for security reasons

Check comment at the top of the file and also
http://www.dwheeler.com/essays/filenames-in-shell.html
Add set -eu at the top to avoid problems
set +u sometimes necessary
Add escaping of semicolon
Use -r flag of rm only if necessary

Also, update to a more concise syntax for conditionals using test
instead of if + [
Merge branch 'master' of red:/disk/spare/gitroot/pub/shx
Forgot to quote important variable
Make script more readable and avoid eval
Add test suite for shx
Import test script of escape from scripts to shx
set -u later only

Because the script can fail if the user didn't pass any parameter,
failing at trying to expand "$@".
Don't use "path" as name of a variable

Although with different case, some shells (like zsh) can confuse it with
$PATH.
Better handling of strange name files

like ones that start with a dash.
Instead of set shell opts, save and restore them

Check
http://www.dwheeler.com/essays/filenames-in-shell.html#save-restore
for details.