Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to work out file permissions (not working!)

Status
Not open for further replies.

PSD

Instructor
Apr 25, 2000
392
GB
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?
 
Seems like your version of ksh doesn't support array assignment.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks guys, in between posting this I tried it in KSH93 and it works - thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top