Answers for "how to use in statment in 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 switch case

case $1 in
start)
    #Start logic
    ;;
stop)
    # Stop logic
    ;;
*)
	# Default logic
    echo $"Usage: $0 {start|stop}"
    exit 1
    ;;
esac
Posted by: Guest on September-14-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language