← Back to Upcase

Sign In to Upcase

© 2012 - 2016 thoughtbot, inc. Upcase, the design of a robot, and thoughtbot are registered trademarks of thoughtbot, inc.


This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/shell-scripting

I tried set -o pipefail in the shell script. When I execute the script. I get the following output:

./print-services.sh: 4: set: Illegal option -o pipefail

any idea what’s going on?

@serixscorpio On many systems, /bin/sh isn’t actually a standard sh. For example, on OSX, it’s symlinked to Bash. I suspect that you’re using something other than OSX (maybe a BSD?) that symlinks to something that doesn’t support set -o. (You can check this by running /bin/sh --version in your terminal and seeing what it says. Mine says GNU Bash and then a version.)

To fix your set -o issue, change #!/bin/sh at the top of the file to #!/bin/bash.

Thanks a lot man!