I want to call a bash script like this
$ ./scriptName -o -p -t something path/to/file
This is as far as I get
#!/bin/bash
o=false
p=false
while getopts ":opt:" options
do
case $options in
o ) opt1=true
;;
p ) opt2=true
;;
t ) opt3=$OPTARG
;;
esac
done
but how do I get the path/to/file
?
You can do something like:
shift $(($OPTIND - 1))
first_arg=$1
second_arg=$2
after the loop has run.