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, ...