100迭代和登录时间的bash shell脚本拍摄 [英] bash shell script for 100 iteration and log time taken

查看:136
本文介绍了100迭代和登录时间的bash shell脚本拍摄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何运行使用一个bash shell脚本100次迭代?我想知道这将需要多长时间来执行一个命令(开始和结束时间)。我想跟踪其迭代当前正在运行。我要记录的迭代。我有一个自动化的脚本我需要运行并记录它。

How do I run 100 iterations using a bash shell script? I want to know how long will it take to execute one command (start and end time). I want to keep track which iteration is currently running. I want to log each iteration. I have one automated script I need to run and log it.

for i in 1 2 3
do
    command1
done

不过,我想知道需要多长时间才能完成一次迭代 - 和写入信息的日志文件太

But I want to know how long it takes to complete one iteration - and write the information to a log file too!

推荐答案

您可以互为作用使用序列以及

You may use seq in interation as well:

对于我在'序列1 100`;做......做

for i in `seq 1 100`; do ... done

这篇关于100迭代和登录时间的bash shell脚本拍摄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆