Skip to main content
Add `set -o verbose` example.
Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

You can add --verbose to the shebang line:

#!/bin/bash --verbose

If you’re running this on Linux, because of the way the kernel handles shebang lines, you can only add one parameter in this way. In shell scripts you can control certains shell options using set; in this instance

#!/bin/bash

set -o verbose

blah
blah

(Although that will only show commands after the set line, whereas having --verbose in the shebang line shows all the commands, including the shebang.)

You can add --verbose to the shebang line:

#!/bin/bash --verbose

If you’re running this on Linux, because of the way the kernel handles shebang lines, you can only add one parameter in this way. In shell scripts you can control certains shell options using set.

You can add --verbose to the shebang line:

#!/bin/bash --verbose

If you’re running this on Linux, because of the way the kernel handles shebang lines, you can only add one parameter in this way. In shell scripts you can control certains shell options using set; in this instance

#!/bin/bash

set -o verbose

blah
blah

(Although that will only show commands after the set line, whereas having --verbose in the shebang line shows all the commands, including the shebang.)

Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

You can add --verbose to the shebang line:

#!/bin/bash --verbose

If you’re running this on Linux, because of the way the kernel handles shebang lines, you can only add one parameter in this way. In shell scripts you can control certains shell options using set.