我正在尝试使用whiptail显示一个巨大的.txt文件,但遇到错误
bash:
/bin/whiptail: Argument list too long已执行命令:
whiptail --title "Licensing Info" --yesno "`cat /file/location/LICENSE.txt`" --scrolltext 50 100 --yes-button Accept --no-button Reject --fb我还尝试使用--textbox,但我无法在whiptail命令中提供yes或no按钮。
发布于 2017-05-26 01:48:11
显然,看起来bash shell参数超过了最大字符数,这就是我猜“参数列表太长”错误的原因。
我做了一个变通方法并解决了我的问题:
if(whiptail --title "Licensing Info" --textbox "/path/to/file/location/LICENSE.txt" --scrolltext 25 75 --ok-button "Proceed to confirm" --fb); then
if(whiptail --title "Licensing Info" --yesno "Please confirm to install the update" --scrolltext 25 75 --yes-button Accept --no-button Reject --fb); then
echo "Accepted"
else
echo "Rejected"
exit 0
fi
else
echo "Rejected"
exit 0
fi如果有人遇到这样的问题,希望这能有所帮助。
https://stackoverflow.com/questions/44170289
复制相似问题