Bash Choosing tabless menu formatting

I created a simple selection menu in Bash. It currently displays the menu horizontally (with tabs):

1) Create a VM from scratch 3) Command-line Usage 2) Management Menu 4) Quit 

I would like the list to look like this:

 1) Create a VM from scratch 2) Management Menu 3) Command-line Usage 4) Quit 

UPDATE : here is my code:

 PS3="Please choose a valid option : " OPTIONS=("Create a VM from scratch" "Management Menu" "Command-line Usage" "Quit") select opt in "${OPTIONS[@]}"; do case $opt in "Create a VM from scratch") createit exit ;; "Management Menu") mgmtmenu exit ;; "Command-line Usage ") help ;; "Quit") exit ;; *) echo invalid option;; esac done 

How can I display a selection menu with each option on its own line?

+5
source share
1 answer

Bash defines the $COLUMNS environment $COLUMNS that is read by select .

As you can see from the bash man :

 COLUMNS Used by the select compound command to determine the terminal width when printing selection lists. Automatically set if the checkwinsize option is enabled or in an interactive shell upon receipt of a SIGWINCH. 
+6
source

All Articles