简体   繁体   English

在终端中运行更多sh

[英]Run more sh in terminal

How can I run multiple files in one sh file? 如何在一个sh文件中运行多个文件?

I tried this but without any luck, seems like it only run the first one. 我尝试了这个,但是没有运气,好像它只运行第一个。 Can someone please help me though? 有人可以帮我吗?

sh ./robots.sh
sh ./update_robots.sh
sh ./update_auctions_end.sh
sh ./auto_bidders.sh

Best regards 最好的祝福

My files of the .sh files containing while.. 我的.sh文件中包含while ..的文件

while [ true ] do php /Applications/XAMPP/xamppfiles/htdocs/xxxx/cronjob/auction.end.php sleep 30 done

Create single file all.sh 创建单个文件all.sh

Inside all.sh 在all.sh里面

 ./robots.sh
 ./update_robots.sh
 ./update_auctions_end.sh
 ./auto_bidders.sh

ultimately, I am asking to remove sh word in all.sh 最终,我要求在all.sh中删除sh词

If you are trying to get them to run at the same time (as mentioned in your comment), use & . 如果你试图让他们在同一时间运行(在你的评论中提及),使用&

In your case: 在您的情况下:

#!/bin/bash
./robots.sh &
./update_robots.sh &
./update_auctions_end.sh &
./auto_bidders.sh &

This will run each of the scripts in the background. 这将在后台运行每个脚本。

Make sure that you've given all the scripts execute permission (easiest way probably chmod +x script ). 确保已授予所有脚本执行权限(最简单的方法可能是chmod +x script )。

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

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