简体   繁体   中英

Shell script on a Raspberry Pi

Let me start by stating how little I know about all the programming stuff: Very very little. I'm having a weird (to me) problem..

I have the following script:

#!/bin/bash
xdg-open #http://xxx.xxx.xx.xxx

while [ 1 ]
do
xdtool key space
sleep 70
done

I can run the xdg open alone and it works, I can run the while portion alone and it works, but I cannot combine them..

What am I doing wrong?

Adding my comment as an answer since it seems to solve to problem.

xdg-open is executed in the foreground and the shell waits until that process terminates before continuing. Change that line to run in the background instead using xdg-open ... & . Read more about job control here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM