i search about syntax of switch statment in google and i found many result ... i try it but no one give me result .... i want to ask about switch statment format please ?????

link|improve this question

feedback

2 Answers

up vote 1 down vote accepted

In bash there is the case statement

case string1 in
str1)
   commands;;
str2)
   commands;;
*)
   commands;;
esac
link|improve this answer
feedback

The switch statement in bash is called case. See help case for details.

case "$1" in
  -p) echo 'Hello, world!' ; exit 0 ;;
  -h|*) usage ; exit 1 ;;
esace
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.