Tuesday, 28 June 2016


Who knows what $POSIXLY_CORRECT actually does, but it cost me an hour of time today. I needed to use process substitution <() with openssl to use a string as the input instead of a file. The command worked in my zsh console, but move it to the script, and poof! I was greeted with this error: syntax error near unexpected token `('. Apparently this can happen if $POSIXLY_CORRECT is enabled (set to "Y"), but that shouldn't happen in bash (I had the line #!/bin/bash at the start of my file).

It seems that because I was calling my bash file like this: "sh script.sh" it didn't work. I had to call "bash script.sh". Then $POSIXLY_CORRECT was not set and I was good to go.