bash - `xdotool type ` - randomly repeats characters -


I am writing a script to automate work environment preparation. I need to open the 4 terminal window, organize them, and execute the commands in each of them.

This works, but sometimes fails me dirty - xdotool type randomizes some characters < / Strong>:

  RVM access to Ruby -1.999999999999999999999999999999.3- P1994AO & amp; Rail c ~ / my_src / ruby_apps / ro & gt; RVM's use of Ruby -1.9999999999999999999999999999999.3- P1994RO & amp; Rail c ruby-1.9999999999999999999999999999999999.33-p194 is not installed. What to do to install: 'rvm install ruby-1.9999999999999999999999999999993- p194' ~ / my_src / ruby_apps / ro & gt;   

or in another window:

  tail -fn 100 looooooog / thin.0.log ~ / my_src / ruby_apps / ro & gt; Tail fn 100 looooooog / thin.0.log tail: can a «looooooog / thin.0.log» »open for reading: No such file or directory Tail: No files ~ / my_src / ruby_apps / ro & Gt;   

I think this depends on the CPU load, because I have a lot of bigger. The processor loaded by ATOM and its load scripts are high during processing.

I script wait and so and open_lxterminal_execute_hold () function using specially ordered Invocation before the Simple commands . It reduces errors, but does not prevent them at all.

Would you recommend getting static results regardless of CPU load (whatever)? It would be great to get rid of So too.

  #! / Bin / bash # # Preparing the work environment for the rail project # Opens the Litoralal with the title # Window # with such a title does not exist, executes the command and remains open. # Nothing else does #function open_lxterminal_execute_hold () {local winid = 'xwininfo -name $ title 2 & gt; / Dev / null | Grep 'windows id:' | Cut-d "" -f4` if [-n "$ winid"]; Then "title" window "for $ titled" $ Winid 'exists with' other Lindermanl -T $ titled sleep 1 wmctrl -i -a "$ winid" # put in front of the window, Aksdotul type "$" command Wait Waiting Xdotool Key Return # Run Command Command Wait} pkill devilspie cd ~ / my_src / ruby_apps / ro # TODO Ultimate Title = 'Rail-Command Line'; Order = 'ls'; Open_lxterminal_execute_hold title = 'Rail-development.log'; Command = 'tail-fn 100 log / development log'; Open_lxterminal_execute_hold title = 'rail-user_case'; Command = 'tails-fn 100 log / thin .0.log'; Open_lxterminal_execute_hold sleep 5 title = 'rail-console'; Command = 'RVM Rabbi 1.9.3-P1994 & amp; Rail c '; Open_lxterminal_execute_hold / usr / bin / devilspie -a 2 & gt; / Dev / null & amp; How to stop Xdotool repeating charatcers?   

UPDATE = "Text">

here And the solution, which has been tested on my Ubuntu 11.04 system and working:

  #! / Bin / bash function open_lxterminal_execute_hold () {xwininfo -name $ 1 & gt; / Dev / null 2 ​​& gt; 1 and if [$? -E 0 0]; Then "window" already exists for the title "$ 1" and "echo" echo "T = $ (tempfile)". ~ / .bashrc "& gt; $ T echo" $ 2 "& gt; & gt; $ t Lictorminl -T $ 1 -e" $ SHELL - Arkefail $ T "& amp; fi} #pkill devilspie #cd ~ / my_src / ruby_apps / ro open_lxterminal_execute_hold 'rail-Commands' 'ls' open_lxterminal_execute_hold 'Rail Vikas' tail -fn 100 log / development.log 'open_lxterminal_execute_hold' rail User_case 'tail -fn 100 log / thin .0.log' # open_lxterminal_execute_hold 'rail-console' Arvim Rabbi 1.9.3 -pl 94 @ End and amp; rail c '#devilspie -a 2 & gt; / dev / null & amp;   

Like That you can see, I have commented on some lines for testing, so you have to Following the lines noted before running the ' # ' trailing line should be removed from your system. The trick I have used is waiting to use "xdotool" option is not required.
In this way, to begin with a "new terminal" in a new shell, the "," "and" sleep "command.

Comments