Skip to main content
added 389 characters in body
Source Link
Charles Duffy
  • 1.9k
  • 18
  • 22

Use env to ignore the readonly flags.

env SHELLOPTS=xtrace ./yourscript 

Alternately, if you have set -x in your parent shell, you can export SHELLOPTS to cause it to be copied into the environment, and thus to the child (thanks to Joe Casadonte for this):

set -x # set xtrace flag export SHELLOPTS # copy all options, including xtrace flag, to environment ./yourscript 

Use env to ignore the readonly flags.

env SHELLOPTS=xtrace ./yourscript 

Use env to ignore the readonly flags.

env SHELLOPTS=xtrace ./yourscript 

Alternately, if you have set -x in your parent shell, you can export SHELLOPTS to cause it to be copied into the environment, and thus to the child (thanks to Joe Casadonte for this):

set -x # set xtrace flag export SHELLOPTS # copy all options, including xtrace flag, to environment ./yourscript 
Source Link
Charles Duffy
  • 1.9k
  • 18
  • 22

Use env to ignore the readonly flags.

env SHELLOPTS=xtrace ./yourscript