2013-08-28 33 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的东西有所帮助。 –

相关问题