diff --git a/bash_completion b/bash_completion index ebd8eef26a2..e67cc3d51a4 100644 --- a/bash_completion +++ b/bash_completion @@ -2072,12 +2072,12 @@ if [[ $OSTYPE == *@(solaris|aix)* ]]; then # This function completes on process IDs. _comp_compgen_pids() { - _comp_compgen_split -- "$(command ps -efo pid | command sed 1d)" + _comp_compgen_split -- "$(command ps -efo pid | tail -n +2)" } _comp_compgen_pgids() { - _comp_compgen_split -- "$(command ps -efo pgid | command sed 1d)" + _comp_compgen_split -- "$(command ps -efo pgid | tail -n +2)" } _comp_compgen_pnames() { @@ -2098,7 +2098,7 @@ else { local -a procs=() if [[ ${1-} == -s ]]; then - _comp_split procs "$(command ps ax -o comm | command sed -e 1d)" + _comp_split procs "$(command ps ax -o comm | tail -n +2)" else # Some versions of ps don't support "command", but do "comm", e.g. # some busybox ones. Fall back diff --git a/completions-core/2to3.bash b/completions-core/2to3.bash index 0a60e1f2551..a75abad575f 100644 --- a/completions-core/2to3.bash +++ b/completions-core/2to3.bash @@ -11,7 +11,7 @@ _comp_cmd_2to3() ;; -f | --fix | -x | --nofix) _comp_compgen_split -- "$( - "$1" --list-fixes 2>/dev/null | command sed -e 1d + "$1" --list-fixes 2>/dev/null | tail -n +2 )" return ;; diff --git a/completions-core/7z.bash b/completions-core/7z.bash index 7333ba605e7..bcc6870ee13 100644 --- a/completions-core/7z.bash +++ b/completions-core/7z.bash @@ -99,7 +99,7 @@ _comp_cmd_7z() if [[ ${words[1]} == d ]]; then _comp_compgen_split -l -- "$( "$1" l "${words[2]}" -slt 2>/dev/null | command sed -n \ - '/^Path =/s/^Path = \(.*\)$/\1/p' 2>/dev/null | tail -n+2 + 's/^Path = \(.*\)$/\1/p' 2>/dev/null | tail -n+2 )" compopt -o filenames else diff --git a/completions-core/cfrun.bash b/completions-core/cfrun.bash index 445bccd0f26..9b81e83f76a 100644 --- a/completions-core/cfrun.bash +++ b/completions-core/cfrun.bash @@ -33,7 +33,7 @@ _comp_cmd_cfrun() done [[ ! -f $hostfile ]] && return - _comp_compgen_split -- "$(command grep -v -E '(=|^$|^#)' \ + _comp_compgen_split -- "$(command grep -v -E '=|^$|^#' \ "$hostfile")" fi ;; diff --git a/completions-core/curl.bash b/completions-core/curl.bash index dc61bc4ccf6..489160f8d1e 100644 --- a/completions-core/curl.bash +++ b/completions-core/curl.bash @@ -129,7 +129,7 @@ _comp_cmd_curl() return ;; --proto-default) - _comp_compgen_split "$("$1" --version 2>/dev/null | command sed -e '/Protocols/!d' -e 's/Protocols://')" + _comp_compgen_split "$("$1" --version 2>/dev/null | command sed -n 's/Protocols://p')" ;; --pubkey) _comp_compgen -x ssh identityfile pub diff --git a/completions-core/fio.bash b/completions-core/fio.bash index 51eb74ea600..ed3fd52e2c7 100644 --- a/completions-core/fio.bash +++ b/completions-core/fio.bash @@ -2,7 +2,7 @@ _comp_cmd_fio__compgen_engines() { - _comp_compgen_split -F $'\t\n' -- "$("$1" --enghelp 2>/dev/null | command sed -ne '/^[[:space:]]/p')" + _comp_compgen_split -F $'\t\n' -- "$("$1" --enghelp 2>/dev/null | command grep '^[[:space:]]')" } _comp_cmd_fio() diff --git a/completions-core/function.bash b/completions-core/function.bash index 218f0cfe74c..ba8d725109a 100644 --- a/completions-core/function.bash +++ b/completions-core/function.bash @@ -8,7 +8,7 @@ _comp_cmd_function() if ((cword == 1)); then _comp_compgen -- -A function else - local funcdef=$(type -- "${words[1]}" 2>/dev/null | command sed -e 1,2d) + local funcdef=$(type -- "${words[1]}" 2>/dev/null | tail -n +3) COMPREPLY=("()${funcdef:+ $funcdef}") fi } && diff --git a/completions-core/inotifywait.bash b/completions-core/inotifywait.bash index c971dc05f9e..8b5b10a6bd2 100644 --- a/completions-core/inotifywait.bash +++ b/completions-core/inotifywait.bash @@ -7,7 +7,7 @@ _comp_cmd_inotifywait__events() # wrapped explanations. _comp_compgen -a split -- "$("$1" --help 2>/dev/null | command sed -e '/^Events:/,/^[^'$'\t'']/!d' \ - -ne 's/^'$'\t''\([^ '$'\t'']\{1,\}\)[ '$'\t''].*/\1/p')" + -ne 's/^'$'\t''\([^[:blank:]]\{1,\}\)[[:blank:]].*/\1/p')" } _comp_cmd_inotifywait() diff --git a/completions-core/mcrypt.bash b/completions-core/mcrypt.bash index 3135244e496..2c8595eb88f 100644 --- a/completions-core/mcrypt.bash +++ b/completions-core/mcrypt.bash @@ -26,7 +26,7 @@ _comp_cmd_mcrypt() ;; -h | --hash) _comp_compgen_split -- "$("$1" --list-hash 2>/dev/null | - command sed -e 1d)" + tail -n +2)" return ;; -k | -s | --key | --keysize) diff --git a/completions-core/mplayer.bash b/completions-core/mplayer.bash index 55ba54df821..84898965e6c 100644 --- a/completions-core/mplayer.bash +++ b/completions-core/mplayer.bash @@ -54,7 +54,7 @@ _comp_cmd_mplayer() ;; -subcp | -msgcharset) local cp - if _comp_split cp "$(iconv --list 2>/dev/null | command sed -e "s@//@@;" 2>/dev/null)"; then + if _comp_split cp "$(iconv --list 2>/dev/null | command sed -e "s@//@@" 2>/dev/null)"; then if [[ $cur == "${cur,,}" ]]; then _comp_compgen -- -W '"${cp[@],,}"' else diff --git a/completions-core/msynctool.bash b/completions-core/msynctool.bash index 0348170e0c0..e40ba91396f 100644 --- a/completions-core/msynctool.bash +++ b/completions-core/msynctool.bash @@ -12,18 +12,18 @@ _comp_cmd_msynctool() return ;; --addmember) - _comp_compgen_split -- "$("$1" --listplugins | command sed -e 1d)" + _comp_compgen_split -- "$("$1" --listplugins | tail -n +2)" return ;; esac case $prev in --configure | --addgroup | --delgroup | --showgroup | --sync | --addmember) - _comp_compgen_split -- "$("$1" --listgroups | command sed -e 1d)" + _comp_compgen_split -- "$("$1" --listgroups | tail -n +2)" return ;; --showformats | --filter-objtype | --slow-sync) - _comp_compgen_split -- "$("$1" --listobjects | command sed -e 1d)" + _comp_compgen_split -- "$("$1" --listobjects | tail -n +2)" return ;; esac diff --git a/completions-core/pdftotext.bash b/completions-core/pdftotext.bash index a99fd400e4f..5d7acba52a4 100644 --- a/completions-core/pdftotext.bash +++ b/completions-core/pdftotext.bash @@ -11,8 +11,7 @@ _comp_cmd_pdftotext() return ;; -enc) - _comp_compgen_split -- "$("$1" -listenc 2>/dev/null | - command sed -e 1d)" + _comp_compgen_split -- "$("$1" -listenc 2>/dev/null | tail -n +2)" return ;; -eol) diff --git a/completions-core/sitecopy.bash b/completions-core/sitecopy.bash index 87e877556a9..a0319f03198 100644 --- a/completions-core/sitecopy.bash +++ b/completions-core/sitecopy.bash @@ -43,8 +43,7 @@ _comp_cmd_sitecopy() esac if [[ -r ~/.sitecopyrc ]]; then - _comp_compgen_split -- "$("$1" -v | - command sed -n '/^Site:/s/Site: //p')" + _comp_compgen_split -- "$("$1" -v | command sed -n 's/^Site: //p')" fi } && complete -F _comp_cmd_sitecopy -o default sitecopy diff --git a/completions-core/xgamma.bash b/completions-core/xgamma.bash index 946c126d45f..73210d960aa 100644 --- a/completions-core/xgamma.bash +++ b/completions-core/xgamma.bash @@ -8,7 +8,7 @@ _comp_cmd_xgamma() case "$prev" in -screen) local screens=$(xrandr --query 2>/dev/null | command sed -n \ - '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null) + 's|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null) _comp_compgen -- -W "$screens" return ;; @@ -31,7 +31,7 @@ _comp_cmd_xgamma() elif [[ $cur == :*.* ]]; then # local screen numbers local screens=$(xrandr --query 2>/dev/null | command sed -ne \ - '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null) + 's|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null) cur=${cur#:} _comp_compgen -P "${cur%.*}." -- -W '$screens' elif [[ $cur != *:* ]]; then