簡體   English   中英

自動Enter鍵不適用於Linux Mint 15

[英]Automating Enter keypress not working for Linux Mint 15

我已經為Linux Mint 14的用戶制作了這個安裝后腳本(也可以在Ubuntu 12.10上使用),現在我正在Linux Mint 15和'echo -ne“ \\ n”進行測試。 sudo add-apt-repository ppa:some-ppa-to-add'命令在Linux Mint 15上不起作用,但在Mint 14上仍然起作用。我想為新版本的Linux Mint更新此腳本。

這是我的post scipt的鏈接: The Minty Developer

Mint 14的輸出如下所示:

$ echo -ne "\n" | sudo add-apt-repository ppa:apt-fast/stable
You are about to add the following PPA to your system:
 This PPA contains tested (stable) builds of apt-fast.
 More info: https://launchpad.net/~apt-fast/+archive/stable
gpg: keyring `/tmp/tmpddxueh/secring.gpg' created
gpg: requesting key CA8DA16B from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpddxueh/trustdb.gpg: trustdb created
gpg: key CA8DA16B: public key "Launchpad PPA for apt-fast" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

這是Mint 15的輸出:

$ echo -ne "\n" | sudo add-apt-repository ppa:apt-fast/stable
You are about to add the following PPA to your system:
This PPA contains tested (stable) builds of apt-fast.
More info: https://launchpad.net/~apt-fast/+archive/stable

就是這樣。 什么都沒發生。 我也測試過只做echo | ppa:some-ppa-to-add,結果相同。

誰能幫助我弄清楚如何使這行代碼/命令起作用,以便對於有興趣在新版本系統中使用腳本的人進行更新?

謝謝。

您可以使用add-apt-repository --yes但是您將通過回答該問題來覆蓋系統范圍的安全策略。

您不會說用戶是誰; 如果您的腳本幫了我大忙,我會很生氣,但是我不是典型的最終用戶。 我只是看了看你的劇本,一般來說,它足夠對話。 如果說類似

我將從合理可靠的來源中添加這些軟件包並進行設置,以使其自動更新等。

會更有禮貌。

添加

add-apt-repository有一個未記錄的功能,可讓您以編程方式覆蓋該問題:

if (sys.stdin.isatty() and
  not "FORCE_ADD_APT_REPOSITORY" in os.environ):
    if options.remove:
        print(_("Press [ENTER] to continue or ctrl-c to cancel removing it"))
            else:
        print(_("Press [ENTER] to continue or ctrl-c to cancel adding it"))
        sys.stdin.readline()

因此bash序列

export FORCE_ADD_APT_REPOSITORY=force
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo add-apt-repository ...

應該停止問題。 它仍然會顯示噪音

You are about to add the following PPA to your system:
 Sublime Text 2 packages - the .deb will automatically download the 
 latest build from http://www.sublimetext.com/dev or beta from
 http://www.sublimetext.com/2 (Adobe Flash Player installer - style).

More info and feedback: 
http://www.webupd8.org/2011/03/sublime-text-2-ubuntu-ppa.html
http://www.webupd8.org/2012/03/sublime-text-2-ppa-separate-development.html
 More info: https://launchpad.net/~webupd8team/+archive/sublime-text-2

但這是放在stdout上的,因此應該能夠將其發送到> /dev/null並且在stderr上仍然會出現錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM