diff --git a/share/functions/__fish_complete_pids.fish b/share/functions/__fish_complete_pids.fish index b670944cf..65ba47946 100644 --- a/share/functions/__fish_complete_pids.fish +++ b/share/functions/__fish_complete_pids.fish @@ -5,11 +5,7 @@ function __fish_complete_pids -d "Print a list of process identifiers along with set -l SELF %self # Display the tty if available - set -l sed_cmds 's/ *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$/\1'\t'\2 [\3]/' - # But not if it's just question marks, meaning no tty - set -l sed_cmds $sed_cmds 's/ *\[\?*\] *$//' - - ps axc -o pid,ucomm,tty | grep -v '^\s*'$SELF'\s' | tail -n +2 | sed -E "-e "$sed_cmds ^/dev/null + 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 diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish index fbcd8b4f7..b5f06da48 100644 --- a/share/functions/__fish_print_hostnames.fish +++ b/share/functions/__fish_print_hostnames.fish @@ -14,7 +14,7 @@ function __fish_print_hostnames -d "Print a list of known hostnames" # Print hosts with known ssh keys # Does not match hostnames with @directives specified - __fish_sgrep -Eoh '^[^#@|, ]*' ~/.ssh/known_hosts{,2} ^/dev/null | sed -E 's/^\[([^]]+)\]:([0-9]+)$/\1/' + __fish_sgrep -Eoh '^[^#@|, ]*' ~/.ssh/known_hosts{,2} ^/dev/null | string replace -r '^\[([^]]+)\]:[0-9]+$' '$1' # Print hosts from system wide ssh configuration file if [ -e /etc/ssh/ssh_config ]