在telnet脚本中运行xterm时出错

时间:2017-07-23 17:17:28

标签: bash shell xterm

运行telnet脚本时出错。 语言:Shell脚本

错误:

输入xterm -help以获取完整描述。

xterm: Explicit shell already was /root/Desktop/stage2/./close_telnet.sh
xterm: bad command line option "192.168.0.1 25"

usage:  xterm [-/+132] [-C] [-Sccn] [-T string] [-/+ah] [-/+ai] [-/+aw]
    [-b number] [-/+bc] [-bcf milliseconds] [-bcn milliseconds] [-bd color]
    [-/+bdc] [-bg color] [-bw number] [-/+cb] [-cc classrange] [-/+cjk_width]
    [-class string] [-/+cm] [-/+cn] [-cr color] [-/+cu] [-/+dc]
    [-display displayname] [-e command args ...] [-fa pattern] [-fb fontname]
    [-/+fbb] [-/+fbx] [-fd pattern] [-fg color] [-fi fontname] [-fn fontname]
    [-fs size] [-/+fullscreen] [-fw fontname] [-fwb fontname] [-fx fontname]
    [%geom] [#geom] [-geometry geom] [-help] [-/+hm] [-/+hold] [-iconic]
    [-/+ie] [-/+im] [-into windowId] [-/+j] [-/+k8] [-kt keyboardtype] [-/+l]
    [-/+lc] [-lcc path] [-leftbar] [-lf filename] [-/+ls] [-/+maximized]
    [-/+mb] [-mc milliseconds] [-/+mesg] [-/+mk_width] [-ms color] [-n string]
    [-name string] [-nb number] [-/+nul] [-/+pc] [-/+pob] [-report-colors]
    [-report-fonts] [-rightbar] [-/+rv] [-/+rvc] [-/+rw] [-/+s] [-/+samename]
    [-/+sb] [-selbg color] [-selfg color] [-/+sf] [-sh number] [-/+si] [-/+sk]
    [-sl number] [-/+sm] [-/+sp] [-/+t] [-ti termid] [-title string]
    [-tm string] [-tn name] [-/+u8] [-/+uc] [-/+ulc] [-/+ulit] [-/+ut] [-/+vb]
    [-version] [-/+wc] [-/+wf] [-xrm resourcestring] [-ziconbeep percent]

Type xterm -help for a full desc

请提出任何解决此错误的建议。

1 个答案:

答案 0 :(得分:1)

可能的问题是$window_id是一个空值。这将产生来自xterm的错误消息。

在快速检查中,我将wmctrl -lp的输出设为

$ wmctrl -lp                                                                    
0x00400023  0 1036         localhost.localdomain [!./bar] - vile           
0x00a0000a  0 3981   localhost.localdomain xclock xclock

xprop表达式的输出为 0x0400023 (前导零的数量不同)。

如果我更改片段

awk '{print $5}' | sed 's/,//' | sed 's/^0x/0x0/'

awk '{sub(",","",$5);printf("%#010x",$5);}'

它提供了一个可用的结果(对于我的机器:ymmv)。