Hi DTicky,
Assume that there r 3 depts. and in for each dept. there r 3 ques. The undermentioend script will give user option to choose between depts. and printer ques. The user can enable his/her desired que through this script without wntering the command. Change the print ques according to ur requirement.
while true
do
tput clear
echo "^[[4m Printer Status ^[[0m"
tput cud1
echo " Department A = 1 "
echo " Department B = 2 "
echo " Department C = 3 "
echo " Exit = 4 "
tput cud1
echo "Enter your choice : \c"
read opt
case $opt in
1) lpstat -ad1a,d1b,d1c | grep -v : | pg ;;
2) lpstat -ad2a,d2b,d2c | grep -v : | pg ;;
3) lpstat -ad3a,d3b,d3c | grep -v : | pg ;;
4) break ;;
esac
echo "Do you want to enable any que [Y/N] : \c"
read ans1
if [ $ans1 = "Y" -o $ans1 = "y" ]
then
tput cud1
echo "Enter que name to activate : \c"
read quenm
quenm=`echo $quenm | tr "A-Z" "a-z"`
if [ $opt = "1" ]
then
case $quenm in
d1a|d1b|d1c) disable d1a d1b d1c
enable $quenm ;;
*) echo "^[[5mInvalid que name^[[0m" ;;
esac
else
if [ $opt = "2" ]
then
case $quenm in
d2a|d2b|d2c) disable d2a d2b d2c
enable $quenm ;;
*) echo "^[[5mInvalid que name^[[0m" ;;
esac
else
if [ $opt = "3" ]
then
case $quenm in
d3a|d3b|d3c) disable d3a d3b d3c
enable $quenm ;;
*) echo "^[[5mInvalid que name^[[0m" ;;
esac
fi
fi
fi
fi
done
Best Regards,
vivek