linux - set -e overwrites parameter variable($@) in bash script -


i have script test.sh

#/!bin/bash set -e trap errorhandler err  errorhandler(){     status=$?     trap - err     exit $status }  echo "$@"  exit 0 

when call sh test.sh 'hey' print -e instead of hey.

work around surround set -e backticks dont know if still works intended

workaround store in variable in first line set -e in first line 1 obvious reason (handling error).

there clever way this? "hey don't touch $@" command.

got it! -e , –e notice dash. first 1 correct.

lesson learned. not copy code directly html.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -