Can anyone help me to fix this... Some Course WK.
It goes in a loop (i.e it repeats the chosen command)
when you select an option from add or remove attribute.
e-mail me please.
Can anyone write me a similar script to simplify the GREP command
without removing functionality, please?
**************************Cut here***************************************
q=0
q1=0
while (test $q -ne 3)
do
echo "\n\n"
echo " CHMOD UTILITY"
echo " **************"
echo " 1. ADD privileges"
echo " 2. REMOVE privileges"
echo "\n\n"
echo " 3. Exit "
read q
case $q in
1)
while (test $q1 -ne 11)
do
echo "\n\n"
echo "\n\n\n\n\n\n\n\n"
echo " ADD ATTRIBUTE TO A FILE"
echo " ***********************"
echo " 1. Display directory listing"
echo "\n"
echo " 2. Add read access to user"
echo " 3. Add read access to group"
echo " 4. Add read access to others"
echo "\n"
echo " 5. Add write access to user"
echo " 6. Add write access to group"
echo " 7. Add write access to others"
echo "\n"
echo " 8. Add execute access to user"
echo " 9. Add execute access to group"
echo " 10. Add execute access to others"
echo "\n\n"
echo " 11. RETURN TO PREVIOUS MENU"
read q1
while (test $q1 -ne 11)
do
echo "\n\n"
if (test $q1 -ne 1) then
echo "Enter filename of file to change access rights to : \c"
read fileid1
fi
case $q1 in
1)
ls -l | more ; echo "Press <RETURN> to continue" ; read presskey ; clear
;;
2)
chmod u+r $fileid1
;;
3)
chmod g+r $fileid1
;;
4)
chmod o+r $fileid1
;;
5)
chmod u+w $fileid1
;;
6)
chmod g+w $fileid1
;;
7)
chmod o+w $fileid1
;;
8)
chmod u+x $fileid1
;;
9)
chmod g+x $fileid1
;;
10)
chmod o+x $fileid1
esac
fileid1="aa"
done
done
;;
2)
while (test $q1 -ne 11)
do
echo "\n\n"
echo "\n\n\n\n\n\n\n\n"
echo " REMOVE ATTRIBUTE FROM FILE"
echo " **************************"
echo " 1. Display directory listing"
echo "\n"
echo " 2. Remove read access to user"
echo " 3. Remove read access to group"
echo " 4. Remove read access to others"
echo "\n"
echo " 5. Remove write access to user"
echo " 6. Remove write access to group"
echo " 7. Remove write access to others"
echo "\n"
echo " 8. Remove execute access to user"
echo " 9. Remove execute access to group"
echo " 10. Remove execute access to others"
echo "\n\n"
echo " 11. RETURN TO PREVIOUS MENU"
read q
while (test $q1 -ne 11)
do
echo "\n\n"
if (test $q1 -ne 1) then
echo "Enter filename of file to change access rights to : \c"
read fileid1
fi
case $q1 in
1)
ls -l | more ; echo "Press <RETURN> to continue" ; read presskey ; clear
;;
2)
chmod u-r $fileid1
;;
3)
chmod g-r $fileid1
;;
4)
chmod o-r $fileid1
;;
5)
chmod u-w $fileid1
;;
6)
chmod g-w $fileid1
;;
7)
chmod o-w $fileid1
;;
8)
chmod u-x $fileid1
;;
9)
chmod g-x $fileid1
;;
10)
chmod o-x $fileid1
;;
esac
fileid1="aa"
done
done
;;
esac
done
;;