如何使用输入文件 file.data
配置 whiptail
对话框?
whiptail --menu "foo" 0 0 0 2>/tmp/out
file.data
的内容:
"01" "Item 1"
"02" "Item 2"
"03" "Item 3"
"04" "Item 5"
dialog
支持 --file
选项:
dialog --file /tmp/file.data
但是 whiptail
没有。有没有类似的东西?
最佳答案
我认为您需要手动构建参数列表。
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
关于bash - 如何从文件中包含 whiptail 的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15229986/