How can I pass parameters to a script like that:
scriptname.ksh -p param1 -n param2 
I mean how can I tell my script to work with two parameters defined by -p and -n characters?
while getopts ":p:n:" Option; do
  case $Option in
    p)
      # do stuff
      # to access param1, use variable $OPTARG
      ;;
    n)
      # do stuff
      # $OPTARG again to access param2
      ;;
    \?)
      # default
      ;;
  esac
done
shift $(($OPTIND - 1))
In the first argument to getopts:
: supresses getopts's own internal error reporting:, it means it expects an $OPTARGgetopts provides faculties for changing the name of the option argument variable.
note that getopts cannot process "long-form" arguments (--help etc.)
?) error "invalid option: -$OPTARG"; show_help; exit 1 ;;