[英]Loop bash shell script
I have a bash shell script that outputs an iCal event using iCal Buddy which displays 2 events like: 我有一个bash shell脚本,该脚本使用iCal Buddy输出一个iCal事件,该事件显示2个事件,例如:
I would like to have the script output like: 我想要脚本输出如下:
(wait 10 seconds) clear the Event Title, Event Date, then output the next Event Title, Event Date (wait 10 seconds) then loop back to the first Event and continue looping. (等待10秒)清除事件标题,事件日期,然后输出下一个事件标题,事件日期(等待10秒),然后循环回到第一个事件并继续循环。 I've tried using the command followed by sleep 10, and repeating the command with | 我试过使用命令sleep 10,然后使用|重复该命令。 head -n 4 | 头-n 4 | tail -n 2, although then it only outputs the second Event. tail -n 2,尽管随后它仅输出第二个Event。
How can I do this? 我怎样才能做到这一点? (my shell script is below) Thanks! (我的shell脚本在下面)谢谢!
/usr/local/bin/icalBuddy -npn -nc -n -iep "title,datetime" -b "★ " -ps "| ★\n|" -po "title,datetime" -nrd -df "%a, %b %e" eventsToday+2 | cut -c 1-33
2 2
Unless I misunderstand you, this should do what you want: 除非我误解了您,否则这应该做您想要的:
while true
do
clear
command | pipeline | head -n 2
sleep 10
clear
command | pipeline | head -n 4 | tail -n 2
sleep 10
done
Where "command | pipeline" represents the icalBuddy
and cut
in your question. 其中“命令|管道”代表icalBuddy
并cut
您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.