问题描述
我编写了一个 bash 脚本,它创建了 10 个终端,然后解析一个文件并在其中一个终端上随机写入一个命令。但是,xdotool 似乎冻结了我的整个 ubuntu 窗口,以供鼠标使用。我必须按 alt+ctrl+f1 并重新启动 Ubuntu 才能“解冻”它。
脚本如下:
#!/bin/bash
printf "$FBOLD\nPlease enter the port: $FREG"
read invalue
for i in {1..9}; do
xterm -title "node$i" -hold -e "node index.js localhost:${invalue}" &
sleep 1
done
filename='insert.txt'
while read line; do
# reading each line
#sleep 1
R=$((1 + $RANDOM % 10))
echo "$R"
# set focus on xterm with title `node...`
xdotool windowfocus --sync $(xdotool search --name "node$R")
xdotool type "insert $line"
xdotool key Return
# xdotool key Return
done < $filename
什么可能导致冻结?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)