$type -a signals
bash: type: signals: not found
$type -a _signals
_signals is a function
_signals ()
{
local -a sigs=($( compgen -P "$1" -A signal "SIG${cur#$1}" ));
COMPREPLY+=("${sigs[@]/#${1}SIG/${1}}")
}
$declare -F _signals
_signals
$shopt -s extdebug
$declare -F _signals
_signals 862 /usr/share/bash-completion/bash_completion
$declare -F _command
_command 1732 /usr/share/bash-completion/bash_completion
$declare -F compgen
$declare -F _grub_dirs
$declare -F _grub_dir
$shopt -s extdebug
$declare -F _grub_dir
$declare -F _grub_dirs
$declare -F __grub_dir
__grub_dir 20 /etc/bash_completion.d/grub
$
$type __grub_dir
__grub_dir is a function
__grub_dir ()
{
local i c=1 boot_dir;
for ((c=1; c <= ${#COMP_WORDS[@]}; c++ ))
do
i="${COMP_WORDS[c]}";
case "$i" in
--boot-directory)
c=$((++c));
i="${COMP_WORDS[c]}";
boot_dir="${i##*=}";
break
;;
esac;
done;
boot_dir=${boot_dir-/boot};
echo "${boot_dir%/}/grub"
}
$__grub_dir
/boot/grub
$__grub_dir --help
/boot/grub
$ech0 $?
bash: ech0: command not found
$echo $?
127
$__grub_dir --help
/boot/grub
$echo $?
0
$
$_command
bash: COMP_WORDS: bad array subscript
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
bash: compopt: not currently executing completion function
$type _command
_command is a function
_command ()
{
local offset i;
offset=1;
for ((i=1; i <= COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
offset=$i;
break;
fi;
done;
_command_offset $offset
}
$type -a _command
_command is a function
_command ()
{
local offset i;
offset=1;
for ((i=1; i <= COMP_CWORD; i++ ))
do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
offset=$i;
break;
fi;
done;
_command_offset $offset
}
$