EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools



Bash - Parameters

  • The first parameter passed to the script is $1, the second $2 and so on
  • If you want to to check more then one possibilities of parameter passed to the script then a case is useful

case "$1" in
  start)
        # start
        command 1
        command 2
        command 3
        ;;
  stop)
        # stop
        command 1
        command 2
        command 3
        ;;
  *)
        # anything other
        echo "Use: {start|stop}" >&2
        exit 1
        ;;
esac
bashscr/parameter.txt · Last modified: 02.04.2013 15:48 by eanderalx