Replace some echos with printfs.
This commit is contained in:
parent
c755d7becc
commit
6807b5e72d
@ -383,7 +383,7 @@ _filedir()
|
||||
local -a toks
|
||||
local tmp
|
||||
|
||||
# TODO: I've removed a "[ -n $tmp ] &&" before `echo $tmp',
|
||||
# TODO: I've removed a "[ -n $tmp ] &&" before `printf '%s\n' $tmp',
|
||||
# and everything works again. If this bug
|
||||
# suddenly appears again (i.e. "cd /b<TAB>"
|
||||
# becomes "cd /"), remember to check for
|
||||
@ -396,7 +396,7 @@ _filedir()
|
||||
toks=( ${toks[@]-} $(
|
||||
compgen -d -- "$(quote_readline "$cur")" | {
|
||||
while read -r tmp; do
|
||||
echo $tmp
|
||||
printf '%s\n' $tmp
|
||||
done
|
||||
}
|
||||
))
|
||||
@ -406,7 +406,7 @@ _filedir()
|
||||
toks=( ${toks[@]-} $(
|
||||
compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | {
|
||||
while read -r tmp; do
|
||||
[ -n $tmp ] && echo $tmp
|
||||
[ -n $tmp ] && printf '%s\n' $tmp
|
||||
done
|
||||
}
|
||||
))
|
||||
@ -658,10 +658,12 @@ _services()
|
||||
local sysvdir famdir
|
||||
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
|
||||
famdir=/etc/xinetd.d
|
||||
COMPREPLY=( $( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)) )
|
||||
COMPREPLY=( $( printf '%s\n' \
|
||||
$sysvdir/!(*.rpm@(orig|new|save)|*~|functions) ) )
|
||||
|
||||
if [ -d $famdir ]; then
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)) )
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( printf '%s\n' \
|
||||
$famdir/!(*.rpm@(orig|new|save)|*~) ) )
|
||||
fi
|
||||
|
||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
|
||||
@ -814,7 +816,7 @@ _service()
|
||||
} &&
|
||||
complete -F _service service
|
||||
[ -d /etc/init.d/ ] && complete -F _service -o default \
|
||||
$(for i in /etc/init.d/*; do echo ${i##*/}; done)
|
||||
$(for i in /etc/init.d/*; do printf '%s\n' ${i##*/}; done)
|
||||
|
||||
|
||||
# chown(1) completion
|
||||
@ -1241,7 +1243,7 @@ _known_hosts_real()
|
||||
[ $# -lt $OPTIND ] && echo "error: $FUNCNAME: missing mandatory argument CWORD"
|
||||
cur=${!OPTIND}; let "OPTIND += 1"
|
||||
[ $# -ge $OPTIND ] && echo "error: $FUNCNAME("$@"): unprocessed arguments:"\
|
||||
$(while [ $# -ge $OPTIND ]; do echo ${!OPTIND}; shift; done)
|
||||
$(while [ $# -ge $OPTIND ]; do printf '%s\n' ${!OPTIND}; shift; done)
|
||||
|
||||
[[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
|
||||
kh=()
|
||||
@ -1649,7 +1651,7 @@ _filedir_xspec()
|
||||
compgen -d -- "$(quote_readline "$cur")" | {
|
||||
while read -r tmp; do
|
||||
# see long TODO comment in _filedir() --David
|
||||
echo $tmp
|
||||
printf '%s\n' $tmp
|
||||
done
|
||||
}
|
||||
))
|
||||
@ -1657,7 +1659,7 @@ _filedir_xspec()
|
||||
toks=( ${toks[@]-} $(
|
||||
eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | {
|
||||
while read -r tmp; do
|
||||
[ -n $tmp ] && echo $tmp
|
||||
[ -n $tmp ] && printf '%s\n' $tmp
|
||||
done
|
||||
}
|
||||
))
|
||||
@ -1676,7 +1678,7 @@ list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' $BASH_COMPLETION | \
|
||||
line=${line##*\'}
|
||||
list=( "${list[@]}" $line )
|
||||
done
|
||||
echo "${list[@]}"
|
||||
printf '%s ' "${list[@]}"
|
||||
)
|
||||
) )
|
||||
# remove previous compspecs
|
||||
|
@ -8,7 +8,7 @@ _bk() {
|
||||
cur=`_get_cword`
|
||||
|
||||
BKCMDS="$( bk help topics | command grep '^ bk' | cut -d ' ' -f 4 | \
|
||||
xargs echo )"
|
||||
xargs printf '%s ' )"
|
||||
|
||||
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
|
||||
_filedir
|
||||
|
@ -110,7 +110,7 @@ _dpkg_reconfigure()
|
||||
|
||||
case "$prev" in
|
||||
-f|--frontend)
|
||||
opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
|
||||
opt=( $( printf '%s\n' /usr/share/perl5/Debconf/FrontEnd/* ) )
|
||||
opt=( ${opt[@]##*/} )
|
||||
opt=( ${opt[@]%.pm} )
|
||||
COMPREPLY=( $( compgen -W '${opt[@]}' -- "$cur" ) )
|
||||
|
@ -103,7 +103,7 @@ _find()
|
||||
# remove word from list of completions
|
||||
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
|
||||
done
|
||||
echo "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
|
||||
printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}"
|
||||
) )
|
||||
|
||||
_filedir
|
||||
|
@ -40,9 +40,9 @@ _mplayer()
|
||||
IFS=$'\t\n'
|
||||
COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
|
||||
if [[ -f $i && -r $i ]]; then
|
||||
echo ${i%.*}
|
||||
printf '%s\n' ${i%.*}
|
||||
else
|
||||
echo $i
|
||||
printf '%s\n' $i
|
||||
fi
|
||||
done ) )
|
||||
IFS=$' \t\n'
|
||||
|
@ -65,7 +65,7 @@ _muttconffiles()
|
||||
done
|
||||
shift
|
||||
done
|
||||
echo $sofar
|
||||
printf '%s\n' $sofar
|
||||
} # _muttconffiles()
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ _update_rc_d()
|
||||
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|
||||
|| sysvdir=/etc/init.d
|
||||
|
||||
services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
|
||||
services=( $(printf '%s ' $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
|
||||
services=( ${services[@]#$sysvdir/} )
|
||||
options=( -f -n )
|
||||
|
||||
@ -78,7 +78,8 @@ _invoke_rc_d()
|
||||
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|
||||
|| sysvdir=/etc/init.d
|
||||
|
||||
services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) )
|
||||
services=( $( printf '%s ' \
|
||||
$sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save)) ) )
|
||||
services=( ${services[@]#$sysvdir/} )
|
||||
options=( --help --quiet --force --try-anyway --disclose-deny --query \
|
||||
--no-fallback )
|
||||
|
@ -49,7 +49,7 @@ _tar()
|
||||
# devise how to untar and list it
|
||||
untar=t${COMP_WORDS[1]//[^Izjyf]/}
|
||||
|
||||
COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
|
||||
COMPREPLY=( $( compgen -W "$( printf '%s ' $( tar $untar $tar \
|
||||
2>/dev/null ) )" -- "$cur" ) )
|
||||
return 0
|
||||
fi
|
||||
|
@ -107,7 +107,7 @@ _xvnc4viewer()
|
||||
local option oldNoCaseMatch=$(shopt -p nocasematch)
|
||||
shopt -s nocasematch
|
||||
COMPREPLY=( $( for option in "${options[@]}"; do
|
||||
[[ $dash$option == "$cur"* ]] && echo $dash$option
|
||||
[[ $dash$option == "$cur"* ]] && printf '%s\n' $dash$option
|
||||
done ) )
|
||||
eval "$oldNoCaseMatch" 2> /dev/null
|
||||
else
|
||||
|
@ -18,7 +18,7 @@ _ypmatch()
|
||||
else
|
||||
[[ $1 == ypmatch && $COMP_CWORD -ne 2 ]] && return 0
|
||||
COMPREPLY=( $( compgen -W \
|
||||
'$( echo $(ypcat -x | cut -d"\"" -f 2))' -- "$cur"))
|
||||
'$( printf "%s\n" $(ypcat -x | cut -d"\"" -f 2) )' -- "$cur"))
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user