Permission Change
# cat change_perm.sh
===========================================================================
#!/bin/bash
#
# INPUT : perm1.list
#------------------------------------
# /etc/cron.deny 644
# /etc/at.deny 640
#------------------------------------
#
# OUTPUT: perm3.list
#------------------------------------
# /etc/cron.deny 644 rw-r--r--
# /etc/at.deny 640 rw-r----
#------------------------------------
FIRST1=
PERM_CHAR=
> perm2.list
> perm3.list
cat perm1.list | while read FILE PERM
do
for i in `seq 1 3`
do
FIRST=$(echo $PERM | cut -c$i)
case $FIRST in
0) FIRST1='---' ;;
1) FIRST1='--x' ;;
2) FIRST1='-w-' ;;
3) FIRST1='-wx' ;;
4) FIRST1='r--' ;;
5) FIRST1='r-x' ;;
6) FIRST1='rw-' ;;
7) FIRST1='rwx' ;;
*) echo "error" ; exit 10 ;;
esac
PERM_CHAR="${PERM_CHAR}${FIRST1}"
[ $i -eq 3 ] && echo $PERM_CHAR >> perm2.list && PERM_CHAR=
done
done
paste perm1.list perm2.list > perm3.list
echo "---------- perm3.list-------------"
cat perm3.list
===========================================================================