Imp Shell Prog
Imp Shell Prog
References:
;;
2)
echo "ENTER FIRST STRING:"
read str1
echo "ENTER SECOND STRING:"
read str2
str1="$str1$str2"
echo "COMBINED STRING : $str1"
;;
3)
echo "ENTER STRING:"
read str
len=`echo $str | wc -c`
echo "Length of string is $len"
;;
4)
echo "ENTER STRING:"
read str
echo "ENTER character of word to search:"
read search
len=`echo $str | wc -c`
i=1
while [ $i -lt $len ]
do
ch=`echo $str | cut -c $i`
echo $ch
i=`expr $i + 1`
done
;;
5)
echo "NOT THERE"
;;
6)
echo "ENTER STRING:"
read str
echo "REVERSE STRING IS : "`echo $str | rev`
;;
*)
echo "ENTER PROPER CHOICE"
echo "NOT THERE"
;;
esac
Script-8: A shell script illustrating the use of the break and continue.
ans=y
while [ “$ans” = “y” ]
echo” MENU\n
1. List of files\n2. Today’s Date\n3. Process Status\n4. Users of the
System\n5. present working directory\n6. Quit to Unix\n Enter your option :
\c”
read choice
case “$choice” in
l) ls I ;;
2) date ;;
3) ps ;;
4) who ;;
5) pwd ;;
6) break ;;
*) echo “Invalid Choice”
continue ;;
esac