38 lines
585 B
Bash
38 lines
585 B
Bash
#!/usr/bin/env bash
|
|
|
|
option_one() {
|
|
set -o emacs
|
|
bind 'set show-all-if-ambiguous on'
|
|
bind 'set completion-ignore-case on'
|
|
|
|
COMP_WORDBREAKS=${COMP_WORDBREAKS//:/}
|
|
|
|
bind 'TAB:dynamic-complete-history'
|
|
|
|
urls=(http://example.com http://sample.net http://example.org)
|
|
|
|
for i in "${urls[@]}"; do
|
|
history -s "$i"
|
|
done
|
|
|
|
echo "${urls[@]}"
|
|
|
|
compgen -W "${urls[@]}" http://sa
|
|
read -rep "> "
|
|
|
|
echo "$REPLY"
|
|
}
|
|
|
|
tab(){ # requires bash 4+
|
|
READLINE_LINE=foobar
|
|
READLINE_POINT="${#READLINE_LINE}"
|
|
}
|
|
|
|
option_two() {
|
|
set -o emacs
|
|
bind -x '"\t":"tab"'
|
|
read -rep "> "
|
|
}
|
|
|
|
option_two "$@"
|