/tmp/out file.data的内容: "01" "Item -6ren">
gpt4 book ai didi

bash - 如何从文件中包含 whiptail 的数据?

转载 作者:行者123 更新时间:2023-11-29 09:28:35 25 4
gpt4 key购买 nike

如何使用输入文件 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com