Hi all,
I inherited this script which does not work on AIX:-
touch a; chmod og-rwx a; ui=($(echo 0027 -n | fold -w1));sys=($(perl -e 'printf "%04o\n",(stat shift)[2] & 07777' a | fold -w1));for (( i=0; i<4; i++ )); do echo -n $(( ${ui[$i]} & ${sys[$i]})); done
Basically, it is supposed to check file permissions in the format like umask, so a 644 file would be reported as 0022 in this check.
I get the error:-
ksh: 0403-057 Syntax error: `(' is not expected.
Does anyone have any ideas why this will not work on AIX?
I inherited this script which does not work on AIX:-
touch a; chmod og-rwx a; ui=($(echo 0027 -n | fold -w1));sys=($(perl -e 'printf "%04o\n",(stat shift)[2] & 07777' a | fold -w1));for (( i=0; i<4; i++ )); do echo -n $(( ${ui[$i]} & ${sys[$i]})); done
Basically, it is supposed to check file permissions in the format like umask, so a 644 file would be reported as 0022 in this check.
I get the error:-
ksh: 0403-057 Syntax error: `(' is not expected.
Does anyone have any ideas why this will not work on AIX?