I was trying to modify the bd script to use getopts
. I am a newbie at bash scripting
my script is
while getopts ":hvis:d:" opt
do
...
done
...
echo $somedirpath
cd "$somedirpath"
this runs fine when doing
$ ./bd -v -i -s search
or
$ ./bd -is search -d dir
But when running it like this
$ . ./bd -s search
getopts
doesn't read the arguments at all. And all the variables I set in the while
loop according to the arguments are all not set, so the script no longer works. Please help!