_longopt: Run commands in C locale.

This is a follow-up to commit 822735146f
This commit is contained in:
Igor Murzov 2013-08-14 11:58:23 +04:00
parent f230cfddbd
commit a282d0254c

View File

@ -1781,7 +1781,7 @@ _longopt()
return 0 return 0
;; ;;
--+([-a-z0-9_])) --+([-a-z0-9_]))
local argtype=$( $1 --help 2>&1 | sed -ne \ local argtype=$( LC_ALL=C $1 --help 2>&1 | sed -ne \
"s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" ) "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" )
case ${argtype,,} in case ${argtype,,} in
*dir*) *dir*)
@ -1799,7 +1799,7 @@ _longopt()
$split && return 0 $split && return 0
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ COMPREPLY=( $( compgen -W "$( LC_ALL=C $1 --help 2>&1 | \
sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \ sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \
-- "$cur" ) ) -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace [[ $COMPREPLY == *= ]] && compopt -o nospace