mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-22 07:33:27 +08:00

This is to the benefit of systems with ancient GNU sed, which does not recognize "-E", but only "-r". Fixes #2305 - even if it doesn't replace all `sed -E` invocations in the codebase, the others are unlikely to occur on CentOS and other similarly crusty systems.
12 lines
592 B
Fish
12 lines
592 B
Fish
function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
|
|
# This may be a bit slower, but it's nice - having the tty displayed is really handy
|
|
# 'tail -n +2' deletes the first line, which contains the headers
|
|
# 'grep -v...' removes self from the output
|
|
set -l SELF %self
|
|
|
|
# Display the tty if available
|
|
# But not if it's just question marks, meaning no tty
|
|
ps axc -o pid,ucomm,tty | grep -v '^\s*'$SELF'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
|
|
end
|
|
|