Artificial intelligent assistant

Array into whiptail menu - BASH I would like to show user friendly `whiptail` menu. My goal in `whiptail` is this: Choice1 Choice2 Choice3 Choice4 I have array consist of: Choice1 Choice2 Choice3 Choice4 I run array through loop for like this: for value in ${value[@]} do echo "$value" done I could not add `whiptail` inside echo because I get 4 another menus. I tried script like this: $val=$(whiptail --title "xx" --menu "choose" 16 78 10 for value in ${value[@]} do echo "$value" done 3>&1 1>&2 2>&3) After run above mentioned script my shell looks horrible. shell after script: ![enter image description here]( Is there anybody who solve my problem?

There is several errors in your script, e.g. you should not give the loop iterator the same name as array itself. However your don't need any loop for this task, just put all array elements at once with special array index `@`:


value=(Choice1 "" Choice2 "" Choice3 "" Choice4 "")
whiptail --title "xx" --menu "choose" 16 78 10 "${value[@]}"


Notice empty string inside quotes `""` \- this is description required by `whiptail` menu option, without that you would treat `Choice` and `Choice4` as description:


Choice1 Choice2
Choice3 Choice4


what is probably not what you want.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 01d437750077ee81706a787a7e1513eb