How do I check if the umask prevents the group bits from being set? My attempt:
#!/bin/sh
out=$(umask)
echo "$out"
if (($out & 070) != 0); then
echo "$out"
echo "Incorrect umask" > /dev/tty
exit 1
fi
Output:
./test.sh: line 6: syntax error near unexpected token `!='
./test.sh: line 6: `if (($out & 070) != 0); then'
I'm ok with switching to bash if it makes things easier.
You need to use double parentheses to get an arithmetic evaluation. See https://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs
Or you could treat the umask as a string and use glob-pattern matching:
bash has lots of unique syntax: it's not C/perl-like at all. Read (or at least refer to) the manual and read lots of bash questions here. Keep asking questions.