Linux/Ubuntu set: Illegal option -o pipefail
I had the same error when running script from zsh
and the script began with incorrect shebang.
WRONG, missing !
after #
:
#/bin/bash
rest-of-the-script
Correct:
#!/bin/bash
rest-of-the-script
You are running bin/sh
, on Ubuntu it is a symbolic link pointing to /bin/dash
, but pipefail
is a bashism.
Make the script executable:
chmod +x myscript.sh
and then run the script as follows:
sudo ./myscript.sh