mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-19 21:03:19 -07:00
Fix to allow combined command-line options
Due to a feature/bug in getopt, calling plexupdate.sh with concatenated options (e.g. `plexupdate.sh -cq`), causes an error even though modern versions of getopt have support for that format. The culprit seems to be the "getopt compatibility mode". With these changes, a modern implementation of getopt will work correctly with more complex options, while old versions will continue to work as they currently do (requiring multiple options to be given independently e.g. `plexupdate.sh -c -q`)
This commit is contained in:
parent
4244a57b52
commit
96d115de0e
1 changed files with 6 additions and 1 deletions
|
@ -165,7 +165,12 @@ usage() {
|
|||
|
||||
# Parse commandline
|
||||
ALLARGS=( "$@" )
|
||||
set -- $(getopt acCdfhkopqruU: -- "$@")
|
||||
optstring="acCdfhkopqruU"
|
||||
getopt -T >/dev/null
|
||||
if [ $? -eq 4 ]; then
|
||||
optstring="-o $optstring"
|
||||
fi
|
||||
set -- $(getopt $optstring -- "$@")
|
||||
while true;
|
||||
do
|
||||
case "$1" in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue