Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • Can you simply set set -x in the terminal and run the script? Commented Aug 19, 2019 at 11:49
  • Something like: set -x; ./script.sh ; set +x Commented Aug 19, 2019 at 11:52
  • 5
    @ArkadiuszDrabczyk The trace setting is not inherited by child processes. If it (and other shell settings) was, it would make writing scripts really tricky, as you would have to either reset options in every script, or write alternative code paths for each eventuality. Commented Aug 19, 2019 at 11:56
  • @Kusalananda: The example I posted works for me and if I understand correctly ./script.sh is a child process, right? Commented Aug 19, 2019 at 12:00
  • 2
    @ArkadiuszDrabczyk In bash 5.0.7, it would trace the call to the shell script, but tracing would not be turned on inside the script itself, i.e. the shell option would not be inherited by the script. Commented Aug 19, 2019 at 12:01