I'm trying to write a script using the "Select" command; this works fine, except it lists each option broken into two (Example below).
Also, please bear with me as I am new to this.
Here's the script (The script is not complete):
select profile in $(cat ~/PROFILEFILE | grep -i profile); do
echo $REPLY $profile
done
In this file, there is a list of AWS profiles; for example, [PROFILE XYZ19273].
Running the script lists the options, but the output is as follows.
1)PROFILE
2)XYZ19273
I was expecting something like this.
- PROFILE XYZ19273
How can I make this work? Any tips or feedback is appreciated.
Thank you @tripleee, your comments helped me and pointed me in the right direction. Just in case anyone stumbles on this question. I followed what @wisecracker suggested about using IFS here. I Got rid of the useless cat as well.