How to get Linux autocompletion with numbered menu?
I recommend https://github.com/junegunn/fzf, I started to replace all my in-shell menu choices with this GREAT tool.
It has bash support, batteries included.
Create bash script file with .sh extension
touch menutools.sh
Make bash script file executable
chmod +x menutools.sh
Insert bash interpreter to the script
echo '#!/bin/bash' > menutools.sh
Edit your script file with your menu based script
#!/bin/bashecho '*********************************************'echo '* Menu of Tools *' echo '*********************************************'echo -e "\n\n"echo "(1) Create file"echo "(2) Copy file"echo "(3) Move file"echo -e "\n\n"echo "Enter your choice: "read userChoiceif [ $userChoice == "1" ]; then clear; echo '*********************************************' echo '* Menu of Tools *' echo '*********************************************' echo -e "\n\n" echo -e "************[Creating file]**************\n\n" echo "(1) Enter name for the file: " read fileName touch $fileName echo "$fileName created successfully." fi
Run the script
./menutools.sh
or
bash menutools.sh