2017-05-25 55 views
-1

我想顯示使用鞭尾巨大的.txt文件一個巨大的許可文件,但遇到錯誤Linux的鞭尾:無法顯示

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按鈕。

+0

你爲什麼反駁命令? – Barmar

回答

0

顯然它看起來像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 

希望,如果有人遇到這種問題的,這將幫助。