Answers for "case esac bash"

7

bash case statement

case "$1" in
        start)
            start ;;
        stop)
            stop ;;
        restart)
            stop; start ;;
        *)
            echo $"Usage: $0 {start|stop|restart}"
            exit 1
esac
Posted by: Guest on May-24-2020
1

bash case statement

#!/bin/bash
 
read -p "Enter your choice [yes/no]:" choice
 
case $choice in
     yes)
          echo "Thank you"
          echo "Your type: Yes"
          ;;
     no)
          echo "Ooops"
          echo "You type: No"
          ;;
     *)
          echo "Sorry, invalid input"
          ;;
esac
Posted by: Guest on February-27-2021
0

case esac bash simple example

#!/bin/bash

echo -n "Enter the name of a country: "
read COUNTRY

echo -n "The official language of $COUNTRY is "

case $COUNTRY in

  Lithuania)
    echo -n "Lithuanian"
    ;;

  Romania | Moldova)
    echo -n "Romanian"
    ;;

  Italy | "San Marino" | Switzerland | "Vatican City")
    echo -n "Italian"
    ;;

  *)
    echo -n "unknown"
    ;;
esac
Posted by: Guest on August-03-2021
-1

bash case statement

bash case notation
Posted by: Guest on August-14-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language