I am trying to write a portable installation script for building the compiler for my programming language. You can see the script here:
mkdir ArithmeticExpressionCompiler cd ArithmeticExpressionCompiler if command -v wget &> /dev/null then wget https://flatassembler.github.io/Duktape.zip else curl -o Duktape.zip https://flatassembler.github.io/Duktape.zip fi unzip Duktape.zip if command -v gcc &> /dev/null then gcc -o aec aec.c duktape.c -lm # The linker that comes with recent versions of Debian Linux insists that "-lm" is put AFTER the source files, or else it outputs some confusing error message. else clang -o aec aec.c duktape.c -lm fi ./aec analogClock.aec if command -v gcc &> /dev/null then gcc -o analogClock analogClock.s -m32 else clang -o analogClock analogClock.s -m32 fi ./analogClock However, when I run it on FreeBSD, it complains that wget is not found. But the script checks whether wget exists before calling it. wget is not supposed to be called on FreeBSD. Now, I know FreeBSD uses sh rather than bash, and I suppose my script is not actually POSIX-compliant. So, what am I doing wrong?
&>isbashism