Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为自动打字脚本按RETURN键调用和延迟bash脚本_Bash_Random_Delay_Xdotool - Fatal编程技术网

如何为自动打字脚本按RETURN键调用和延迟bash脚本

如何为自动打字脚本按RETURN键调用和延迟bash脚本,bash,random,delay,xdotool,Bash,Random,Delay,Xdotool,目前,我正在使用一个bash脚本自动键入一个短语,但我想知道如何将睡眠计数器设置为1800-1900秒。如果可能的话,我也想知道如何使脚本延迟按回车键。谢谢 这是剧本 #!/usr/bin/env bash function autotype_loop() { xdotool key space xdotool type "Text here" xdotool key Return sleep 1810 autotype_loop } autotype_loop 此用例有一个内置变量: 'R

目前,我正在使用一个bash脚本自动键入一个短语,但我想知道如何将睡眠计数器设置为1800-1900秒。如果可能的话,我也想知道如何使脚本延迟按回车键。谢谢

这是剧本

#!/usr/bin/env bash
function autotype_loop()  {
xdotool key space
xdotool type "Text here"
xdotool key Return
sleep 1810
autotype_loop
}
autotype_loop

此用例有一个内置变量:

'RANDOM'
     Each time this parameter is referenced, a random integer between 0
     and 32767 is generated.
如果要生成1800-1900之间的随机变量x,可以使用算术表达式:

x=$(( 1800 + $RANDOM * 100 / 32767 ))