many bugfix, fixed getopt split
This commit is contained in:
+27
-13
@@ -52,7 +52,9 @@ expandlist()
|
||||
return 1
|
||||
fi
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
@@ -90,8 +92,8 @@ expandlist()
|
||||
|
||||
local item="" result="" matched=0
|
||||
# Restore the caller's nullglob setting on exit instead of forcing it off.
|
||||
local _saved_nullglob
|
||||
_saved_nullglob=$(shopt -p nullglob)
|
||||
local _had_nullglob=0
|
||||
shopt -q nullglob && _had_nullglob=1
|
||||
shopt -s nullglob
|
||||
# An empty IFS keeps the unquoted expansion below from splitting on spaces
|
||||
# (it would cut "my dir/*.txt" in two) while globbing still happens.
|
||||
@@ -129,7 +131,7 @@ expandlist()
|
||||
unset content
|
||||
done
|
||||
|
||||
eval "$_saved_nullglob"
|
||||
(( _had_nullglob )) || shopt -u nullglob
|
||||
printf '%s\n' "$result"
|
||||
}
|
||||
export -f expandlist
|
||||
@@ -158,7 +160,9 @@ clean()
|
||||
fi
|
||||
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
@@ -289,7 +293,9 @@ rmspc()
|
||||
return 1
|
||||
fi
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
@@ -352,8 +358,8 @@ rmspc()
|
||||
(( verb )) && mvopt=(-v)
|
||||
|
||||
# Restore the caller's nullglob setting on exit instead of forcing it off.
|
||||
local _saved_nullglob
|
||||
_saved_nullglob=$(shopt -p nullglob)
|
||||
local _had_nullglob=0
|
||||
shopt -q nullglob && _had_nullglob=1
|
||||
shopt -s nullglob
|
||||
local f
|
||||
for f in *; do
|
||||
@@ -410,7 +416,7 @@ rmspc()
|
||||
fi
|
||||
done
|
||||
unset f
|
||||
eval "$_saved_nullglob"
|
||||
(( _had_nullglob )) || shopt -u nullglob
|
||||
}
|
||||
export -f rmspc
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -446,7 +452,9 @@ file_stats()
|
||||
return 1
|
||||
fi
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
@@ -701,7 +709,9 @@ findbig()
|
||||
return 1
|
||||
fi
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
@@ -812,7 +822,9 @@ findzero()
|
||||
return 1
|
||||
fi
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
@@ -933,7 +945,9 @@ finddead()
|
||||
return 1
|
||||
fi
|
||||
# Restore the getopt-normalised (shell-quoted) argument list
|
||||
eval set -- "$PARSED"
|
||||
local -a _pargs=()
|
||||
_getopt_split _pargs "$PARSED"
|
||||
set -- "${_pargs[@]}"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
|
||||
Reference in New Issue
Block a user