I am creating an interactive menu in Bash where I want to be writing a text entry, at the same time read a file.txt and with that information show us options to autocomplete our input, something like the autocomplete in jquery. The question is: Is there any way to do this? the code is:
if [ -z "$1" ]; then
echo "========"
read -e -p "HOSTNAME: " HOST
./menu.bash $HOST
elif [ -n "$2" ]; then
clear
echo "ssh $(whoami)@$1"
else
HOST=$1
cat ../data/hosts | egrep ".+\s+\$HOST"
echo "========"
read -e -p "HOSTNAME: " -i "$HOST" HOST2
./menu.bash $HOST2
fi