#!/bin/bash echo $1 cmd= case $1 in start) { echo "Starting server..." cmd="start" } ;; stop) { echo "Stopping server..." cmd="stop" } ;; *) ( echo "Usage: $0 start|stop options" ) ;; esac if [[ "$cmd" == "" ]]; then exit 1 fi shift port= ip= while : ; do case $1 in --ip) { ip=$2 echo "ip = $ip" } ;; --port) { port=$2 echo "port = $port" } ;; *) break;; esac shift shift done