Set
_filedir;
fi
}
_have ()
{
PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin type $1 &> /dev/null
}
_init_completion ()
{
local exclude= flag outx errx inx OPTIND=1;
while getopts "n:e:o:i:s" flag "$@"; do
case $flag in
n)
exclude+=$OPTARG
;;
e)
errx=$OPTARG
;;
o)
outx=$OPTARG
;;
i)
inx=$OPTARG
;;
s)
split=false;
exclude+==
;;
esac;
done;
COMPREPLY=();
local redir="@(?([0-9])<|?([0-9&])>?(>)|>&)";
_get_comp_words_by_ref -n "$exclude<>&" cur prev words cword;
_variables && return 1;
if [[ $cur == $redir* || $prev == $redir ]]; then
local xspec;
case $cur in
2'>'*)
xspec=$errx
;;
*'>'*)
xspec=$outx
;;
*'<'*)
xspec=$inx
;;
*)
case $prev in
2'>'*)
xspec=$errx
;;
*'>'*)
xspec=$outx
;;
*'<'*)
xspec=$inx
;;
esac
;;
esac;
cur="${cur##$redir}";
_filedir $xspec;
return 1;
fi;
local i skip;
for ((i=1; i < ${#words[@]}; 1))
do
if [[ ${words[i]} == $redir* ]]; then
[[ ${words[i]} == $redir ]] && skip=2 || skip=1;
words=("${words[@]:0:i}" "${words[@]:i+skip}");
[[ $i -le $cword ]] && cword=$(( cword - skip ));
else
i=$(( ++i ));
fi;
done;
[[ $cword -le 0 ]] && return 1;
prev=${words[cword-1]};
[[ -n ${split-} ]] && _split_longopt && split=true;
return 0
}
_installed_modules ()
{
COMPREPLY=($( compgen -W "$( PATH="$PATH:/sbin" lsmod | awk '{if (NR != 1) print $1}' )" -- "$1" ))
}
_ip_addresses ()
{
local PATH=$PATH:/sbin;
COMPREPLY+=($( compgen -W "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null |
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' -ne 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" -- "$cur" ))
}
_kernel_versions ()
{
COMPREPLY=($( compgen -W '$( command ls /lib/modules )' -- "$cur" ))
}
_known_hosts ()
{
local cur prev words cword;
_init_completion -n : || return;
local options;
[[ "$1" == -a || "$2" == -a ]] && options=-a;
[[ "$1" == -c || "$2" == -c ]] && options+=" -c";
_known_hosts_real $options -- "$cur"
}
_known_hosts_real ()
{
local configfile flag prefix;
local cur curd awkcur user suffix aliases i host;
local -a kh khd config;
local OPTIND=1;
while getopts "acF:p:" flag "$@"; do
case $flag in
a)
aliases='yes'
;;
c)
suffix=':'
;;
F)
configfile=$OPTARG
;;
p)
prefix=$OPTARG
;;
esac;
done;
[[ $# -lt $OPTIND ]] && echo "error: $FUNCNAME: missing mandatory argument CWORD";
cur=${!OPTIND};
let "OPTIND += 1";
[[ $# -ge $OPTIND ]] && echo "error: $FUNCNAME("$@"): unprocessed arguments:" $(while [[ $# -ge $OPTIND ]]; do printf '%s\n' ${!OPTIND}; shift; done);
[[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@};
kh=();
if [[ -n $configfile ]]; then
[[ -r $configfile ]] && config+=("$configfile");
else
for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config;
do
[[ -r $i ]] && config+=("$i");
done;
fi;
if [[ ${#config[@]} -gt 0 ]]; then
local OIFS=$IFS IFS='
' j;
local -a tmpkh;
tmpkh=($( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u ));
IFS=$OIFS;
for i in "${tmpkh[@]}";
do
while [[ $i =~ ^([^\"]*)\"([^\"]*)\"(.*)$ ]]; do
i=${BASH_REMATCH[1]}${BASH_REMATCH[3]};
j=${BASH_REMATCH[2]};
__expand_tilde_by_ref j;
[[ -r $j ]] && kh+=("$j");
done;
for j in $i;
do
__expand_tilde_by_ref j;
[[ -r $j ]] && kh+=("$j");
done;
done;
fi;
if [[ -z $configfile ]]; then
for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts ~/.ssh/known_hosts2;
do
[[ -r $i ]] && kh+=("$i");
done;
for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys;
do
[[ -d $i ]] && khd+=("$i"/*pub);
done;
fi;
if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then
awkcur=${cur//\//\\\/};
awkcur=${awkcur//\./\\\.};
curd=$awkcur;
if [[ "$awkcur" == [0-9]*[.:]* ]]; then
awkcur="^$awkcur[.:]*";
else
if [[ "$awkcur" == [0-9]* ]]; then
awkcur="^$awkcur.*[.:]";
else
if [[ -z $awkcur ]]; then
awkcur="[a-z.:]";
else
awkcur="^$awkcur";
fi;
fi;
fi;
if [[ ${#kh[@]} -gt 0 ]]; then
COMPREPLY+=($( awk 'BEGIN {FS=","}
/^\s*[^|\#]/ {
sub("^@[^ ]+ +", ""); \
sub(" .*$", ""); \
for (i=1; i<=NF; ++i) { \
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
if ($i !~ /[*?]/ && $i ~ /'"$awkcur"'/) {print $i} \
}}' "${kh[@]}" 2>/dev/null ));
fi;
if [[ ${#khd[@]} -gt 0 ]]; then
for i in "${khd[@]}";
do
if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then
host=${i/#*key_22_/};
host=${host/%.pub/};
COMPREPLY+=($host);
fi;
done;
fi;
for ((i=0; i < ${#COMPREPLY[@]}; i++ ))
do
COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix;
done;
fi;
if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" );
COMPREPLY+=($( compgen -P "$prefix$user" -S "$suffix" -W "$hosts" -- "$cur" ));
fi;
COMPREPLY+=($( compgen -W "$( ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }' )" -- "$cur" ));
if [[ -n ${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1} ]]; then
COMPREPLY+=($( compgen -A hostname -P "$prefix$user" -S "$suffix" -- "$cur" ));
fi;
__ltrim_colon_completions "$prefix$user$cur";
return 0
}
_longopt ()
{
local cur prev words cword split;
_init_completion -s || return;
case "${prev,,}" in
--help | --usage | --version)
return 0
;;
--*dir*)
_filedir -d;
return 0
;;
--*file* | --*path*)
_filedir;
return 0
;;
--+([-a-z0-9_]))
local argtype=$( $1 --help 2>&1 | sed -ne "s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" );
case ${argtype,,} in
*dir*)
_filedir -d;
return 0
;;
*file* | *path*)
_filedir;
return 0
;;
esac
;;
esac;
$split && return 0;
if [[ "$cur" == -* ]]; then
COMPREPLY=($( compgen -W "$( $1 --help 2>&1 | sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" -- "$cur" ));
[[ $COMPREPLY == *= ]] && compopt -o nospace;
else
if [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d;
else
_filedir;
fi;
fi
}
_mac_addresses ()
{
local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}';
local PATH="$PATH:/sbin:/usr/sbin";
COMPREPLY+=($( { LC_ALL=C ifconfig -a || ip link show; } 2>/dev/null | sed -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]].*|\2|p" -ne "s|.*[[:space:]]\(link/\)\{0,1\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$|\2|p"
));
COMPREPLY+=($( { arp -an || ip neigh show; } 2>/dev/null | sed -ne "s/.*[[:space:]]\($re\)[[:space:]].*/\1/p" -ne "s/.*[[:space:]]\($re\)[[:space:]]*$/\1/p" ));
COMPREPLY+=($( sed -ne "s/^[[:space:]]*\($re\)[[:space:]].*/\1/p" /etc/ethers 2>/dev/null ));
COMPREPLY=($( compgen -W '${COMPREPLY[@]}' -- "$cur" ));
__ltrim_colon_completions "$cur"
}
_minimal ()
{
local cur prev words cword split;
_init_completion -s || return;
$split && return;
_filedir
}
_modules ()
{
local modpath;
modpath=/lib/modules/$1;
COMPREPLY=($( compgen -W "$( command ls -RL $modpath 2>/dev/null | sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ))
}
_ncpus ()
{
local var=NPROCESSORS_ONLN;
[[ $OSTYPE == *linux* ]] && var=_$var;
local n=$( getconf $var 2>/dev/null );
printf %s ${n:-1}
}
_parse_help ()
{
eval local cmd=$( quote "$1" );
local line;
{
case $cmd in
-)
cat
;;
*)
LC_ALL=C "$( dequote "$cmd" )" ${2:---help} 2>&1
;;
esac
} | while read -r line; do
[[ $line == *([ ' '])-* ]] || continue;
while [[ $line =~ ((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do
line=${line/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]}"};
done;
__parse_options "${line// or /, }";
done
}
_parse_usage ()
{
eval local cmd=$( quote "$1" );
local line match option i char;
{
case $cmd in
-)
cat
;;
*)
LC_ALL=C "$( dequote "$cmd" )" ${2:---usage} 2>&1
;;
esac
} | while read -r line; do
while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do
match=${BASH_REMATCH[0]};
option=${BASH_REMATCH[1]};
case $option in
-?(\[)+([a-zA-Z0-9?]))
for ((i=1; i < ${#option}; i++ ))
do
char=${option:i:1};
[[ $char != '[' ]] && printf '%s\n' -$char;
done
;;
*)
__parse_options "$option"
;;
esac;
line=${line#*"$match"};
done;
done
}
_pci_ids ()
{
COMPREPLY+=($( compgen -W "$( PATH="$PATH:/sbin" lspci -n | awk '{print $3}')" -- "$cur" ))
}
_pgids ()
{
COMPREPLY=($( compgen -W '$( command ps axo pgid= )' -- "$cur" ))
}
_pids ()
{
COMPREPLY=($( compgen -W '$( command ps axo pid= )' -- "$cur" ))
}
_pnames ()
{
COMPREPLY=($( compgen -X '<defunct>' -W '$( command ps axo command= | \
sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" -e "s/^[[(-]//" \
-e "s/[])]$//" | sort -u )' -- "$cur" ))
}
_poff ()
{
local prev cur conns;
[ -r /etc/ppp/peers/ ] || return 0;
COMPREPLY=();
prev=${COMP_WORDS[COMP_CWORD-1]};
cur=${COMP_WORDS[COMP_CWORD]};
conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$');
if [[ "$cur" == -* ]]; then
COMPREPLY=($(compgen -W '-r -d -c -a -h -v' -- $cur));
return 0;
fi;
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || [[ "$prev" == -* ]]; then
COMPREPLY=($(compgen -o filenames -W "$conns" $cur));
fi;
return 0
}
_pon ()
{
local cur conns;
[ -r /etc/ppp/peers/ ] || return 0;
COMPREPLY=();
cur=${COMP_WORDS[COMP_CWORD]};
conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$');
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($(compgen -o filenames -W "$conns" $cur));
fi;
return 0
}
_quote_readline_by_ref ()
{
if [ -z "$1" ]; then
printf -v $2 %s "$1";
else
if [[ $1 == \'* ]]; then
printf -v $2 %s "${1:1}";
else
if [[ $1 == ~* ]]; then
printf -v $2 ~%q "${1:1}";
else
printf -v $2 %q "$1";
fi;
fi;
fi;
[[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}";
[[ ${!2} == \$* ]] && eval $2=${!2}
}
_realcommand ()
{
type -P "$1" > /dev/null && {
if type -p realpath > /dev/null; then
realpath "$(type -P "$1")";
else
if type -p greadlink > /dev/null; then
greadlink -f "$(type -P "$1")";
else
if type -p readlink > /dev/null; then
readlink -f "$(type -P "$1")";
else
type -P "$1";
fi;
fi;
fi
}
}
_rl_enabled ()
{
[[ "$( bind -v )" = *$1+([[:space:]])on* ]]
}
_root_command ()
{
local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin;
local root_command=$1;
_command
}
_service ()
{
local cur prev words cword;
_init_completion || return;
[[ $cword -gt 2 ]] && return 0;
if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then
_services;
[[ -e /etc/mandrake-release ]] && _xinetd_services;
else
local sysvdirs;
_sysvdirs;
COMPREPLY=($( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
${sysvdirs[0]}/${prev##*/} 2>/dev/null` start stop' -- "$cur" ));
fi
}
_services ()
{
local sysvdirs;
_sysvdirs;
local restore_nullglob=$(shopt -p nullglob);
shopt -s nullglob;
COMPREPLY=($( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions) ));
$restore_nullglob;
COMPREPLY+=($( systemctl list-units --full --all 2>/dev/null | awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ));
COMPREPLY=($( compgen -W '${COMPREPLY[@]#${sysvdirs[0]}/}' -- "$cur" ))
}
_shells ()
{
local shell rest;
while read -r shell rest; do
[[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=($shell);
done 2> /dev/null < /etc/shells
}
_signals ()
{
local -a sigs=($( compgen -P "$1" -A signal "SIG${cur#$1}" ));
COMPREPLY+=("${sigs[@]/#${1}SIG/${1}}")
}
_split_longopt ()
{
if [[ "$cur" == --?*=* ]]; then
prev="${cur%%?(\\)=*}";
cur="${cur#*=}";
return 0;
fi;
return 1
}
_sysvdirs ()
{
sysvdirs=();
[[ -d /etc/rc.d/init.d ]] && sysvdirs+=(/etc/rc.d/init.d);
[[ -d /etc/init.d ]] && sysvdirs+=(/etc/init.d);
[[ -f /etc/slackware-version ]] && sysvdirs=(/etc/rc.d)
}
_terms ()
{
COMPREPLY+=($( compgen -W "$( sed -ne 's/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap 2>/dev/null )" -- "$cur" ));
COMPREPLY+=($( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } | awk '{ print $1 }' | sort -u )" -- "$cur" ))
}
_tilde ()
{
local result=0;
if [[ $1 == \~* && $1 != */* ]]; then
COMPREPLY=($( compgen -P '~' -u "${1#\~}" ));
result=${#COMPREPLY[@]};
[[ $result -gt 0 ]] && compopt -o filenames 2> /dev/null;
fi;
return $result
}
_ufw ()
{
cur=${COMP_WORDS[COMP_CWORD]};
prev=${COMP_WORDS[COMP_CWORD-1]};
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($( compgen -W "$(_ufw_commands)" $cur ));
else
if [ $COMP_CWORD -eq 2 ]; then
case "$prev" in
app)
COMPREPLY=($( compgen -W "$(_ufw_app_commands)" $cur ))
;;
status)
COMPREPLY=($( compgen -W "$(_ufw_status_commands)" $cur ))
;;
delete)
COMPREPLY=($( compgen -W "$(_ufw_rule_commands)" $cur ))
;;
logging)
COMPREPLY=($( compgen -W "$(_ufw_logging_commands)" $cur ))
;;
show)
COMPREPLY=($( compgen -W "$(_ufw_show_commands)" $cur ))
;;
default)
COMPREPLY=($( compgen -W "$(_ufw_default_commands)" $cur ))
;;
esac;
fi;
fi
}
_ufw_app_commands ()
{
ufw --help | sed -e '1,/^Application profile commands:/d' -e '/^ [^ ]/!d' -e 's/[ \t]\+app[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g'
}
_ufw_commands ()
{
commands=$(ufw --help | sed -e '1,/^Commands:/d' -e '/^Application profile commands:/Q' -e 's/^[ \t]\+\([a-z|]\+\)[ \t]\+.*/\1/g' -e 's/|/ /g' | uniq);
echo "$commands app"
}
_ufw_default_commands ()
{
echo "allow deny reject"
}
_ufw_logging_commands ()
{
echo "off on low medium high full"
}
_ufw_rule_commands ()
{
echo "`_ufw_default_commands` limit"
}
_ufw_show_commands ()
{
echo "raw"
}
_ufw_status_commands ()
{
echo "numbered verbose"
}
_uids ()
{
if type getent &> /dev/null; then
COMPREPLY=($( compgen -W '$( getent passwd | cut -d: -f3 )' -- "$cur" ));
else
if type perl &> /dev/null; then
COMPREPLY=($( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- "$cur" ));
else
COMPREPLY=($( compgen -W '$( cut -d: -f3 /etc/passwd )' -- "$cur" ));
fi;
fi
}
_update_initramfs ()
{
local cur prev valid_options;
cur=$(_get_cword);
prev=${COMP_WORDS[COMP_CWORD-1]};
if [[ "$prev" == '-k' ]]; then
_kernel_versions;
COMPREPLY=($( compgen -W '${COMPREPLY[@]} all' -- "$cur" ));
return;
fi;
valid_options=$( update-initramfs -h 2>&1 | sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' );
COMPREPLY=($( compgen -W "$valid_options" -- $cur ))
}
_upstart_events ()
{
( cd /etc/init && egrep --color=auto '^[[:space:]]*emits ' *.conf | cut -d: -f2- | sed 's/^[[:space:]]*emits //g' | tr ' ' '\n' | awk '{print $NF}' | grep --color=auto -v ^$ | sort -u )
}
_upstart_initctl ()
{
_get_comp_words_by_ref cur prev;
COMPREPLY=();
case "$prev" in
start)
COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_startable_jobs)" -- ${cur}));
return 0
;;
stop)
COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_stoppable_jobs)" -- ${cur}));
return 0
;;
emit)
COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_events)" -- ${cur}));
return 0
;;
-i | --ignore-events)
for cmd in check-config;
do
cwords=${COMP_WORDS[@]##};
filtered_cwords=${COMP_WORDS[@]##${cmd}};
if [ "$filtered_cwords" != "$cwords" ]; then
COMPREPLY=($(compgen -W "$(_upstart_jobs)" -- ${cur}));
return 0;
fi;
done
;;
-e | --enumerate)
for cmd in show-config;
do
cwords=${COMP_WORDS[@]##};
filtered_cwords=${COMP_WORDS[@]##${cmd}};
if [ "$filtered_cwords" != "$cwords" ]; then
COMPREPLY=($(compgen -W "$(_upstart_jobs)" -- ${cur}));
return 0;
fi;
done
;;
reload | restart)
COMPREPLY=($(compgen -W "-n --no-wait $(_upstart_stoppable_jobs)" -- ${cur}));
return 0
;;
status)
COMPREPLY=($(compgen -W "$(_upstart_jobs)" -- ${cur}));
return 0
;;
check-config)
COMPREPLY=($(compgen -W "-w --warn -i --ignore-events= $(_upstart_jobs)" -- ${cur}));
return 0
;;
show-config)
COMPREPLY=($(compgen -W "-e --enumerate $(_upstart_jobs)" -- ${cur}));
return 0
;;
-n | --no-wait)
for cmd in start stop restart emit;
do
cwords=${COMP_WORDS[@]##};
filtered_cwords=${COMP_WORDS[@]##${cmd}};
if [ "$filtered_cwords" != "$cwords" ]; then
case "$cmd" in
start)
COMPREPLY=($(compgen -W "$(_upstart_startable_jobs)" -- ${cur}))
;;
stop)
COMPREPLY=($(compgen -W "$(_upstart_stoppable_jobs)" -- ${cur}))
;;
restart)
COMPREPLY=($(compgen -W "$(_upstart_stoppable_jobs)" -- ${cur}))
;;
emit)
COMPREPLY=($(compgen -W "$(_upstart_events)" -- ${cur}))
;;
esac;
return 0;
fi;
done
;;
--help | --version)
COMPREPLY=();
return 0
;;
esac;
opts="--help --version -q --quiet -v --verbose --session --system --dest=";
cmds=$(initctl help|grep "^ [^ ]"|awk '{print $1}');
COMPREPLY=($(compgen -W "${opts} ${cmds}" -- ${cur}))
}
_upstart_jobs ()
{
initctl list | awk '{print $1}' | sort -u
}
_upstart_reload ()
{
COMPREPLY=();
_get_comp_words_by_ref cur prev;
opts="--help --version -q --quiet -v --verbose --session --system --dest=";
case "$prev" in
--help | --version)
COMPREPLY=();
return 0
;;
esac;
COMPREPLY=($(compgen -W "$opts $(_upstart_stoppable_jobs)" -- ${cur}));
return 0
}
_upstart_restart ()
{
COMPREPLY=();
_get_comp_words_by_ref cur prev;
opts="--help --version -q --quiet -v --verbose --session --system --dest= -n --no-wait";
case "$prev" in
--help | --version)
COMPREPLY=();
return 0
;;
esac;
COMPREPLY=($(compgen -W "$opts $(_upstart_stoppable_jobs)" -- ${cur}));
return 0
}
_upstart_start ()
{
COMPREPLY=();
_get_comp_words_by_ref cur prev;
opts="--help --version -q --quiet -v --verbose --session --system --dest= -n --no-wait";
case "$prev" in
--help | --version)
COMPREPLY=();
return 0
;;
esac;
COMPREPLY=($(compgen -W "$opts $(_upstart_startable_jobs)" -- ${cur}));
return 0
}
_upstart_startable_jobs ()
{
initctl list | cut -d\, -f1 | awk '$2 == "stop/waiting" {print $1}'
}
_upstart_status ()
{
COMPREPLY=();
_get_comp_words_by_ref cur prev;
opts="--help --version -q -d --detail -e --enumerate --quiet -v --verbose --session --system --dest=";
case "$prev" in
--help | --version)
COMPREPLY=();
return 0
;;
esac;
COMPREPLY=($(compgen -W "$opts $(_upstart_jobs)" -- ${cur}));
return 0
}
_upstart_stop ()
{
COMPREPLY=();
_get_comp_words_by_ref cur prev;
opts="--help --version -q --quiet -v --verbose --session --system --dest= -n --no-wait";
case "$prev" in
--help | --version)
COMPREPLY=();
return 0
;;
esac;
COMPREPLY=($(compgen -W "$opts $(_upstart_stoppable_jobs)" -- ${cur}));
return 0
}
_upstart_stoppable_jobs ()
{
initctl list | cut -d\, -f1 | awk '$2 == "start/running" {print $1}'
}
_upvar ()
{
if unset -v "$1"; then
if (( $# == 2 )); then
eval $1=\"\$2\";
else
eval $1=\(\"\${@:2}\"\);
fi;
fi
}
_upvars ()
{
if ! (( $# )); then
echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname" "value] | [-aN varname [value ...]] ..." 1>&2;
return 2;
fi;
while (( $# )); do
case $1 in
-a*)
[[ -n ${1#-a} ]] || {
echo "bash: ${FUNCNAME[0]}: \`$1': missing" "number specifier" 1>&2;
return 1
};
printf %d "${1#-a}" &> /dev/null || {
echo "bash:" "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2;
return 1
};
[[ -n "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) && shift $((${1#-a} + 2)) || {
echo "bash: ${FUNCNAME[0]}:" "\`$1${2+ }$2': missing argument(s)" 1>&2;
return 1
}
;;
-v)
[[ -n "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && shift 3 || {
echo "bash: ${FUNCNAME[0]}: $1: missing" "argument(s)" 1>&2;
return 1
}
;;
*)
echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2;
return 1
;;
esac;
done
}
_usb_ids ()
{
COMPREPLY+=($( compgen -W "$( PATH="$PATH:/sbin" lsusb | awk '{print $6}' )" -- "$cur" ))
}
_user_at_host ()
{
local cur prev words cword;
_init_completion -n : || return;
if [[ $cur == *@* ]]; then
_known_hosts_real "$cur";
else
COMPREPLY=($( compgen -u -- "$cur" ));
fi;
return 0
}
_usergroup ()
{
if [[ $cur = *\\\\* || $cur = *:*:* ]]; then
return;
else
if [[ $cur = *\\:* ]]; then
local prefix;
prefix=${cur%%*([^:])};
prefix=${prefix//\\};
local mycur="${cur#*[:]}";
if [[ $1 == -u ]]; then
_allowed_groups "$mycur";
else
local IFS='
';
COMPREPLY=($( compgen -g -- "$mycur" ));
fi;
COMPREPLY=($( compgen -P "$prefix" -W "${COMPREPLY[@]}" ));
else
if [[ $cur = *:* ]]; then
local mycur="${cur#*:}";
if [[ $1 == -u ]]; then
_allowed_groups "$mycur";
else
local IFS='
';
COMPREPLY=($( compgen -g -- "$mycur" ));
fi;
else
if [[ $1 == -u ]]; then
_allowed_users "$cur";
else
local IFS='
';
COMPREPLY=($( compgen -u -- "$cur" ));
fi;
fi;
fi;
fi
}
_userland ()
{
local userland=$( uname -s );
[[ $userland == @(Linux|GNU/*) ]] && userland=GNU;
[[ $userland == $1 ]]
}
_variables ()
{
if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then
[[ $cur == *{* ]] && local suffix=} || local suffix=;
COMPREPLY+=($( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- "${BASH_REMATCH[2]}" ));
return 0;
fi;
return 1
}
_xfunc ()
{
set -- "$@";
local srcfile=$1;
shift;
declare -F $1 &> /dev/null || {
local compdir=./completions;
[[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions";
. "$compdir/$srcfile"
};
"$@"
}
_xinetd_services ()
{
local xinetddir=/etc/xinetd.d;
if [[ -d $xinetddir ]]; then
local restore_nullglob=$(shopt -p nullglob);
shopt -s nullglob;
local -a svcs=($( printf '%s\n' $xinetddir/!($_backup_glob) ));
$restore_nullglob;
COMPREPLY+=($( compgen -W '${svcs[@]#$xinetddir/}' -- "$cur" ));
fi
}
command_not_found_handle ()
{
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1";
return $?;
else
if [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1";
return $?;
else
printf "%s: command not found\n" "$1" 1>&2;
return 127;
fi;
fi
}
dequote ()
{
eval printf %s "$1" 2> /dev/null
}
quote ()
{
local quoted=${1//\'/\'\\\'\'};
printf "'%s'" "$quoted"
}
quote_readline ()
{
local quoted;
_quote_readline_by_ref "$1" ret;
printf %s "$ret"
}
На остальные команды консоль виснет и даже после 20 минут ничего не выводится. Компьютер старый и слабый. Ubuntu слишком тяжела для старого целерона с 256мб озу, а лUbuntu как видим не хочет работать с прокси, может посоветуете другой легковестный линукс дистриб? Основные требования работа в интернете и правильная работа Wine.