Processing a wildcard with getopts
by GPGAgent from LinuxQuestions.org on (#4TEKT)
When I pass a wild card parameter, eg M*.mpg to a script on the command line you need to use $@ like this:
Code:for FF in $@;
do echo "FF: $FF";
ffmpeg -ss 0 -y -i $FF ${FF::-4}.mpg;
done;
exit 0But I can't work out how to use this technique with getopts
Code:while getopts "a:m:" opt; doThis processes -a 1 and does ssomething with it, what that is doesn't really matter here.
What I would like to do is something like -f M*.mpg -w -b 1000k
where -f is a file or files -w will process as widescreen (16:9) and -b is video bitrate.
And the getopts line is this:
Code:while getopts "a:m:" opt; do, so I need some code to extract M*.mpg or the $@ equivalent.


Code:for FF in $@;
do echo "FF: $FF";
ffmpeg -ss 0 -y -i $FF ${FF::-4}.mpg;
done;
exit 0But I can't work out how to use this technique with getopts
Code:while getopts "a:m:" opt; doThis processes -a 1 and does ssomething with it, what that is doesn't really matter here.
What I would like to do is something like -f M*.mpg -w -b 1000k
where -f is a file or files -w will process as widescreen (16:9) and -b is video bitrate.
And the getopts line is this:
Code:while getopts "a:m:" opt; do, so I need some code to extract M*.mpg or the $@ equivalent.