I am trying to have the user select two files from a numbered list which will eventually be turned into a variable then combined. This is probably something simple and stupid that I am doing.
clear
echo "Please Select the Show interface status file"
select FILE1 in *;
echo "Please Select the Show Vlan file"
select FILE2 in *;
do
What language are you using?
I'd recommend looking at the bottom of this thread for More UNIX and Linux Forum Topics You Might Find Helpful
threads.
Also look a simple menu building script as a sample of using select
and case
:
#!/usr/bin/bash
files='*sh';
actions='cat edit quit'
PS3="Pick one of the above [${actions}]: "
TMOUT=10
select i in ${actions}
do
case $i in
cat) eval cat "${files}" ;;
edit) eval ${EDITOR-vi} "${files}" ;;
quit) break ;;
"") print -u2 you must select one of the above [${actions}] ;;
esac
done
2 Likes
Its a shell script.
More or less I am trying to create a list of files from a specific directory (I will already be in that directory),
I will then
"cat FILE1 > file1"
then
"cat FILE2 > file2"
After these files are selected, the program will move on. I've been playing with Shamrocks snippet but no luck. I also have been looking for a similar scenarios with code that resembles what I'm trying to do but perhaps I am searching the wrong keywords.