So I used to start my bash scripts with #!/bin/bash -e
(call bash, and exit on first error)
Now i'm moving to the more portable form #!/usr/bin/env bash
But setting -e
doesn't work
#!/usr/bin/env bash -e
echo 'hi'
# output:
>> /usr/bin/env: ‘bash -e’: No such file or directory
How can I use -e
with the portable shebang?
use:
#!/usr/bin/env -S bash -e
From the env manpage:
-S, --split-string=S
process and split S into separate arguments; used to pass
multiple arguments on shebang lines
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