can’t find the error here. when i run this program BASH comes up with “[ : 17: unexpected operator” i’ve tried it with a parameter ending in .c and with one in .java but neither seems to work.
EXT=`echo $1 | cut -f2 -d"."`
if [ "$EXT" == "c" ]; then
NAME=`echo $1 | cut -f1 -d"."`
gcc -Wall -o "$NAME" "$1"
elif [ "$EXT" == "java" ]; then
NAME=`echo $1 | cut -f1 -d"."`
gcj -c -g -O $1 && gcj --main="$NAME" -o "$NAME" "${NAME}.o"
else
echo "hm... I don't seem to know what to do with that"
fi
test(aka[) doesn’t have an==operator. String equality is=instead. Yes, that’s a little bit weird.Also,
caseis nice for this: