Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/bin/ksh
# # # # #
# if -l or -U or -e is specified,
# perform real ls and awk output to convert -rwxrwxrwx to numeric form
# if no long listing,
# just perform the real ls
longlist=no
for parameter
do
case ${parameter} in
-*l*|-*U*|-*e*)
longlist=yes
;;
esac
done
if [ "${longlist}" = 'yes' ]
then
/usr/bin/ls $*|awk '{
# # #
# look for the field containing permission bits
for (i=1;i<=NF;i++) {
if ($i ~ /^[bcdlps-][r-][w-][xsS-][r-][w-][xsS-][r-][w-][xtT-][E+-]*/) {
num=0;
# # #
# break up into individual bits
tp=substr($i,1,1);
ur=substr($i,2,1); uw=substr($i,3,1); ux=substr($i,4,1);
gr=substr($i,5,1); gw=substr($i,6,1); gx=substr($i,7,1);
or=substr($i,8,1); ow=substr($i,9,1); ox=substr($i,10,1);
ea=substr($i,11,1);
# # #
# substitute type and extended attributes flags if necessary
if (tp=="-") tp=" ";
if (ea=="-") ea=" "; if (ea=="") ea=" ";
# # #
# convert to numeric representation
if (ur=="r") num+=400; if (uw=="w") num+=200;
if (ux=="x") num+=100; if (ux=="s") num+=4100; if (ux=="S") num+=4000;
if (gr=="r") num+=40; if (gw=="w") num+=20;
if (gx=="x") num+=10; if (gx=="s") num+=2010; if (gx=="S") num+=2000;
if (or=="r") num+=4; if (ow=="w") num+=2;
if (ox=="x") num+=1; if (ox=="t") num+=1001; if (ox=="T") num+=1000;
# # #
# print out type of file, numeric representation
# and possibly the extended attributes indication
printf "%s%04d%s ", tp, num, ea;
# # #
# found the permissions field, no need to continue searching
break;
}
}
# # #
# print out original line
print
}'
else
# no longlist
/usr/bin/ls $*
fi