BASH Scripts – Program for 'case' statement

#Program for ‘case’ statement
# Author : Antony
# Last date of modification : 29/07/2007
#Syntax
# case word in
# pattern1)
# list1 ; ;
# pattern2)
# list2 ; ;
# esac

#Simple Example
echo “Select the Option”
echo “1.Terminal”
echo “2.Firefox”
echo “3.Text editor”

read name

case $name in
1) echo “Terminal is running…”
echo “`xterm`” ;;
2) echo “Firefox is running…”
echo “`firefox`” ;;
3) echo “Text editor has been opened …”
echo “`gedit`” ;;
esac

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Spam protection by WP Captcha-Free