2013-08-28 35 views
2

我正在尋找一個GUI控制檯,我可以在一個入口小部件中輸入linux命令,結果將輸出到文本區域小部件中。有這樣的軟件嗎?事情是這樣的:尋找一個GUI應用程序來輸入linux命令

enter image description here

控制檯程序,像GNOME終端或xterm中,屏幕保持與每一個新的命令滾動,我覺得這惱人特別是當結果有幾十行。

我想同時顯示命令和結果,就像瀏覽器在地址欄中輸入網址並獲得網站結果一樣。

謝謝。

+1

你可能在http://unix.stackexchange.com有更多的運氣,stackoverflow通常是編程的具體問題,這是更多的一般Linux應用程序的問題。 – PherricOxide

+1

你爲什麼在乎這種工具在什麼語言中實現?你會拒絕使用一個程序,因爲它是用Perl或C編寫的嗎? – abarnert

+1

@abarnert,當然不介意使用什麼語言,但是看代碼會比較容易,而不是使用C. – milarepa

回答

8

好吧,這樣的事情很容易在Tcl中實現。

package require Tk 8.5 
grid [ttk::entry .input -textvariable input] -sticky nesw 
grid [text .text] -sticky nesw 
grid rowconfigure . .text -weight 1 
grid columnconfigure . .text -weight 1 
bind .input <Return> execute 
bind .input <Up> {histwalk -1} 
bind .input <Down> {histwalk 1} 

proc execute {} { 
    history add $::input 
    set ::eventcnt 0 
    .text delete 1.0 end 
    catch {exec /bin/bash -c $::input} res 
    .text insert 1.0 $res 
    .input selection range 0 end 
} 

set eventcnt 0 
proc histwalk i { 
    incr ::eventcnt $i 
    set ::input [history event $::eventcnt] 
    .input selection range 0 end 
} 
+0

嗯,我省略了滾動條,但是你討厭滾動,對吧? –

+1

感謝您的程序,它按預期工作,但我正在尋找具有更多功能的內容,如命令歷史記錄。是否可以在ttk :: entry小部件中嵌入tclreadline以包含所有readline功能? – milarepa

+2

tclreadline將是這個錯誤的工具,但也許有點histroy的東西有所幫助。 –

相關問題