[Semibug] ksh select command
Nick Holland
nick at holland-consulting.net
Fri Jan 29 08:24:38 EST 2021
Hah. Forgot Anthony was on this list. yes, he showed it to me.
I just violated the BSD principle of stealing everything but the credit! Oops!
Nick.
On 1/28/21 9:06 PM, Anthony Cascianelli wrote:
> That’s awesome! Who showed that this existed?
>
> Anthony Cascianelli
>
>> On Jan 28, 2021, at 8:48 PM, Nick Holland <nick at holland-consulting.net> wrote:
>>
>> Just gotta share...
>>
>> Here's a ksh command I didn't know about until last week.
>>
>> "select" -- a one-line menu command!
>>
>>
>> This code:
>> PS3="Pick one ->"
>> select Z in apple boy cat dog; do
>> echo $Z
>> break
>> done
>>
>> gives this output:
>>
>> 1) apple
>> 2) boy
>> 3) cat
>> 4) dog
>> Pick one ->3
>> cat
>>
>> Obviously, something other than "echo $Z" would go in the body.
>>
>> PS3 sets the prompt.
>>
>> So...did all the world except me know about this, or is this a new one for you?
>>
>> Nick.
>>
>> _______________________________________________
>> Semibug mailing list
>> Semibug at lists.nycbug.org
>> http://lists.nycbug.org:8080/mailman/listinfo/semibug
>
More information about the Semibug
mailing list