Linux/Ubuntu set: Illegal option -o pipefail Linux/Ubuntu set: Illegal option -o pipefail shell shell

Linux/Ubuntu set: Illegal option -o pipefail


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


I had the same error when running script from zsh and the script began with incorrect shebang.

WRONG, missing ! after #:

#/bin/bashrest-of-the-script

Correct:

#!/bin/bashrest-of-the-script