Command line arguments in Bash [duplicate]

Use the getopts builtin:
here’s a tutorial

pages=  length=  time=

while getopts p:l:t: opt; do
  case $opt in
  p)
      pages=$OPTARG
      ;;
  l)
      length=$OPTARG
      ;;
  t)
      time=$OPTARG
      ;;
  esac
done

shift $((OPTIND - 1))

shift $((OPTIND - 1)) shifts the command line parameters so that you can access possible arguments to your script, i.e. $1, $2, ...

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)