mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Make hostname completion code more robust
darcs-hash:20060203004114-ac50b-54fda8fe89649d404cd6981d7783e18f5092f217.gz
This commit is contained in:
parent
294da72d11
commit
19c67db731
1 changed files with 6 additions and 3 deletions
|
@ -140,10 +140,13 @@ end
|
||||||
function __fish_print_hostnames -d "Print a list of known hostnames"
|
function __fish_print_hostnames -d "Print a list of known hostnames"
|
||||||
|
|
||||||
# Print all hosts from /etc/hosts
|
# Print all hosts from /etc/hosts
|
||||||
cat /etc/hosts|sed -e 's/[0-9.]*\( \|\t\)*\(.*\)/\2/'|sed -e 's/\#.*//'|sed -e 'y/\t/\n/'|grep -v '^$'
|
if test -f /etc/hosts
|
||||||
|
sed </etc/hosts -e 's/[0-9.]*\( \|\t\)*\(.*\)/\2/'|sed -e 's/\#.*//'|tr \t \n |grep -v '^$'
|
||||||
|
end
|
||||||
# Print nfs servers from /etc/fstab
|
# Print nfs servers from /etc/fstab
|
||||||
cat /etc/fstab| grep "^\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\|[a-zA-Z.]*\):"|cut -d : -f 1
|
if test -f /etc/fstab
|
||||||
|
grep </etc/fstab "^\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\|[a-zA-Z.]*\):"|cut -d : -f 1
|
||||||
|
end
|
||||||
|
|
||||||
# Print hosts with known ssh keys
|
# Print hosts with known ssh keys
|
||||||
cat ~/.ssh/known_hosts{,2} ^/dev/null|cut -d ' ' -f 1| cut -d , -f 1
|
cat ~/.ssh/known_hosts{,2} ^/dev/null|cut -d ' ' -f 1| cut -d , -f 1
|
||||||
|
|
Loading…
Reference in a new issue