Skip to main content
added 147 characters in body
Source Link
Petr Skocik
  • 29.6k
  • 18
  • 90
  • 154

Newlines in a script are almost always equivalent to semicolons:

mycmd.sh; ret=$?; rm -rf temp_files; exit $ret

In response to the edit:

Alternatively, you could also use a trap and a subshell:

( trap 'rm -rf temp_files' EXIT; mycmd.sh )

Newlines in a script are almost always equivalent to semicolons:

mycmd.sh; ret=$?; rm -rf temp_files; exit $ret

Newlines in a script are almost always equivalent to semicolons:

mycmd.sh; ret=$?; rm -rf temp_files; exit $ret

In response to the edit:

Alternatively, you could also use a trap and a subshell:

( trap 'rm -rf temp_files' EXIT; mycmd.sh )
Source Link
Petr Skocik
  • 29.6k
  • 18
  • 90
  • 154

Newlines in a script are almost always equivalent to semicolons:

mycmd.sh; ret=$?; rm -rf temp_files; exit $ret