Simulating a keystroke using bash

I try to run gedit from the terminal and type in the file that opens there, but have not succeeded. I am trying to use the gedit; sleep 2; xte -x display 'key k'; command gedit; sleep 2; xte -x display 'key k'; gedit; sleep 2; xte -x display 'key k'; but in this case only gedit is started (without k char input). Can any one chip in me?

+7
source share
1 answer

Xdotool (I don't know what happened with the webpage, here is its source ) is excellent for this:

 xdotool key k 

And with gedit:

 gedit & sleep 2; xdotool key k; 
+7
source

All Articles