I want to display a numbered menu from a shell script (#!/bin/sh). Currently I use
echo "choice1 choice2 choice3 choice4 " To output the menu. Now I want to add a number prefix to each line so the result will look like:
1) choice1 2) choice2 3) choice3 4) choice4 ... How can I do this without having to manually prefix each line with a number? I'm thinking I want to iterate over the variable line by line and concatenate the line number and output it to a new variable.