title: How to write user defined options in shell script?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/402377/using-getopts-in-bash-shell-script-to-get-long-and-short-command-line-options">Using getopts in bash shell script to get long and short command line options</a>  </p>
  </blockquote>
  
  
  
  <p>This is the code i've written</p>
  
  <pre><code>#! /bin/bash
  
  getopts master $1
  
  while getopts ":master" opt; do
    case $opt in
      master)
        echo "-master was triggered! $1 was entered" &gt;&amp;2
        ;;
      \?)
        echo "Invalid option: -$OPTARG" &gt;&amp;2
        ;;
    esac
  done
  </code></pre>
  
  <p>and this is the output i'm getting-</p>
  
  <pre><code>]$ ./test123.sh -master 123
  ./test123.sh: line 3: getopts: `-master': not a valid identifier
  </code></pre>
  
  <p>How do i define a user defined option?</p>