[Semibug] ksh select command

Nick Holland nick at holland-consulting.net
Thu Jan 28 20:47:54 EST 2021


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.



More information about the Semibug mailing list