Question: write a script to print your lucky number
Answer:
#!/usr/bin/bash
read -p "What is your lucky number?" num
case $num in
1)
echo "your lucky number is one";;
2)
echo "Your lucky number is two";;
*)
echo "None"
esac
Output:
kalam@DESKTOP-OSJTLNE:~$ sh case_statement.sh
What is your lucky number? 1
your lucky number is one
No comments:
Post a Comment