I have written a bash script that creates 10 terminals, then parses a file and writes a command randomly on one of the terminals. However, xdotool seems to freeze my entire ubuntu window exept for the mouse. I have to press alt+ctrl+f1 and restart Ubuntu to "unfreeze" it.
The script is the following:
#!/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
What could be causing the freeze?