user2093552
user2093552

Reputation: 1247

How to include data for whiptail from file?

How do I configure a whiptail dialog box using an input file file.data?

whiptail --menu "foo" 0 0 0 2>/tmp/out

The content of file.data:

"01" "Item 1"
"02" "Item 2"
"03" "Item 3"
"04" "Item 5"

dialog supports the --file option:

 dialog --file /tmp/file.data

but whiptail does not. Does it have something similar?

Upvotes: 5

Views: 2356

Answers (1)

chepner
chepner

Reputation: 532398

I think you'll need to build your argument list manually.

menu_options=()
while read -r number text; do
    menu_options+=( ${number//\"} "${text//\"}" )
done < file.data

whiptail --menu "foo" 0 0 0 "${menu_options[@]}" 2>/tmp/out

Upvotes: 5

Related Questions