File permission demonstration script
From assela Pathirana
Jump to navigationJump to search
#!/bin/bash fmt="%15s%15s%15s%15s%15s\n" printf $fmt umask file dirs files dirs while read line do set -- $line umask $1 touch tempfile mkdir tempdir fval=`ls -l tempfile|awk '{print $1}'` dval=`ls -dl tempdir|awk '{print $1}'` printf $fmt $1 "$(( 777 - $1 ))" "$(( 666 - $1 ))" $dval $fval rm -rf temp* done << EOF 022 027 002 006 007 077 EOF