简体   繁体   English

Raspberry Pi上的Shell脚本

[英]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.. 我可以单独运行xdg并且它可以工作,我可以单独运行while部分并且它可以工作,但我无法将它们组合起来..

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. xdg-open在前台执行,shell等待,直到该进程终止,然后继续。 Change that line to run in the background instead using xdg-open ... & . 将该行更改为在后台运行,而不是使用xdg-open ... & Read more about job control here 在这里阅读更多关于工作控制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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