- alter _kill() to use /proc, so that it also works on FreeBSD and maybe other
systems, too - alter _killall() to use simpler and more reliable way of getting at the process name
This commit is contained in:
parent
6288ab29d7
commit
54349c16fc
@ -1,6 +1,6 @@
|
|||||||
# bash_completion - some programmable completion functions for bash 2.05a
|
# bash_completion - some programmable completion functions for bash 2.05a
|
||||||
#
|
#
|
||||||
# $Id: bash_completion,v 1.210 2002/03/22 16:54:52 ianmacd Exp $
|
# $Id: bash_completion,v 1.211 2002/03/23 22:59:49 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -466,16 +466,12 @@ _kill()
|
|||||||
_signals
|
_signals
|
||||||
else
|
else
|
||||||
# return list of available PIDs
|
# return list of available PIDs
|
||||||
COMPREPLY=( $( ps ahx | awk '{print $1}' | grep ^$cur ) )
|
COMPREPLY=( $( \ls /proc | grep '^[0-9]\+'| grep ^$cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
complete -F _kill kill
|
complete -F _kill kill
|
||||||
|
|
||||||
# Linux killall(1) completion. This wouldn't be much use on, say,
|
# Linux killall(1) completion.
|
||||||
# Solaris, where killall does exactly that: kills ALL processes.
|
|
||||||
#
|
|
||||||
# This could be improved. For example, it currently doesn't take
|
|
||||||
# command line options into account
|
|
||||||
#
|
#
|
||||||
[ $OS = Linux ] &&
|
[ $OS = Linux ] &&
|
||||||
_killall()
|
_killall()
|
||||||
@ -488,15 +484,7 @@ _killall()
|
|||||||
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
|
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
|
||||||
_signals
|
_signals
|
||||||
else
|
else
|
||||||
# escaoe slashes for awk
|
COMPREPLY=( $( ps axcho ucomm | grep ^$cur ) )
|
||||||
cur=${cur//\//\\\/}
|
|
||||||
# get a list of processes (the sub() in the awk takes care
|
|
||||||
# of getting the basename of the process, the first sed
|
|
||||||
# evaluation takes care of swapped out processes, and the
|
|
||||||
# second takes care of getting the basename of the process)
|
|
||||||
COMPREPLY=( $( ps ahx | sed -e 's#[]\[()]##g' | \
|
|
||||||
awk '{p=$5;sub("^.*/","",p);if (p ~ /^'$cur'/) print $5}' | \
|
|
||||||
sed -e 's#^.*/##' ) )
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -526,7 +514,7 @@ _find()
|
|||||||
;;
|
;;
|
||||||
-fstype)
|
-fstype)
|
||||||
# this is highly non-portable
|
# this is highly non-portable
|
||||||
COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | grep ^$cur ) )
|
COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | grep ^$cur))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-gid)
|
-gid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user