I've been trying to run on Ubuntu 16 a bash script that I developed on CentOS 7.
The first line of the script is:
set -o nounset -o pipefail -o errexit
When I try to run this script, I get the following error:
project.sh: 6: set: Illegal option -o pipefail
How to solve this issue?
I also the solution explain in the answer to this question but it did not help (my file is not a make).
#!/bin/sh? – Sergiy Kolodyazhnyy Feb 23 '17 at 15:08bash scriptname, it the first line#! /bin/bash? – AlexP Feb 23 '17 at 15:09#!/bin/sh, but I was invoking it assh project.shas in CentOS! Now I tried to runbash project.shand the problem disappeared! Thanks guys! – DavideChicco.it Feb 23 '17 at 15:11shis symlink todashshell on Ubuntu. Also, start changing your habits. Usechmod +x script.shand./script.shto run it. The way you do itsh ./script.shhas whole lot of issues of its own and easy to mess up – Sergiy Kolodyazhnyy Feb 23 '17 at 15:12bash project.shfixed your error, then you should change your shebang line to#!/bin/bashthat way you don't have to type in thebashin front of your script name. – Terrance Feb 23 '17 at 15:19