PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bash Case Matching Linux Example

Go down

Bash Case Matching Linux Example Empty Bash Case Matching Linux Example

Post by jamied_uk 10th August 2016, 13:31




Code:
#!/bin/bash
echo -n "Enter the name of an animal: "
read ANIMAL
echo -n "The $ANIMAL has "
case $ANIMAL in
  horse | dog | cat) echo -n "four";;
  penguine | bird | kangaroo ) echo -n "two";;
  spider | fly ) echo -n "eight";;
  snake | whale ) echo -n "none";;
  *) echo -n "an unknown number of";;
esac
echo " legs."
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum