Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想制作一个脚本,每 60 秒运行一次下面的命令,持续 2 小时。还希望在每次运行到文件时将输出保存到新行。
uptime | awk '{print $12}' | cut -d "," -f 1
任何帮助将不胜感激。我有点生疏了。
一个简单的 for 循环应该适合你。
for i in {1..120} do uptime | awk '{print $12}' | cut -d "," -f 1 >> /tmp/outputfile echo "number of times through: ${i}" sleep 60 done