EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools


bashscr:parameter

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
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
bashscr/parameter.txt · Last modified: 02.04.2013 15:48 by eanderalx