I'm currently creating a script to retrieve a set of lines from a file and will let users select any one of them to perform certain task.
Eg:
echo "my_files"
1) my_files1
2) my_files2
3) my_files3
...
n) my_filesN
I want to let the user select any one of these line and perform certain task based on the selection in shell script.
Read the filenames into an array with
readarray
.Use the
select
built-in to display the list of files as a menu.