How come this style works:
#!/bin/bash -x
#...
But this doesn't?
#!/usr/bin/env bash -x
#...
It gives me a not found error. Trace mode needs to be set later as set -x
?
Please note that I can use #!/usr/bin/env bash
.
The shebang-line mechanism only parses the first space and passes the rest of the line as one single argument to the executable, so writing
#!/usr/bin/env bash -x
is like calling
$ /usr/bin/env "bash -x"
on the command line.
There is no executable called "bash -x"
(with a space in the command name), so this fails.
You can always use:
#!/usr/bin/env bash
set -x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With