I'm trying to find out how (if) you can format the output of a select loop. Right now I have:
PS3=$'\nPlease make a selection: '
echo -en "\nMain Menu\n\n"
select OPT in foo bar baz
do
echo "You chose $OPT"
done
and I get this output:
Main Menu
1) foo
2) bar
3) baz
Please make a selection:
but what I'm wanting to know is how can I indent the numbers?
Main Menu
1) foo
2) bar
3) baz
Please make a selection:
Trying to avoid using echo. I can probably do it with printf, but I don't know how. I have a ton of results, so hoping to number them dynamically.
I have found that I can format the individual items like
PS3=$'\nPlease make a selection: '
echo -en "\nMain Menu\n\n"
select OPT in $'\tfoo' $'\tbar' $'\tbaz'
do
echo "You chose $OPT"
done
and I get this output, but that's not really what I'm trying to do:
Main Menu
1) foo
2) bar
3) baz
Please make a selection:
Looking forward to any fresh input on this. I've googled all the things, lol.
Thanks!