#!/bin/bash
for i in `seq 10`
do
    echo 'Count:  '${i}
    echo "hello1"
    echo "hello2"
done

保存成repeat.sh文件,用命令

./repeat.sh
# 或者
bash repeat.sh

更多推荐

[ Ubuntu ] shell脚本编程丨日积月累丨1. 循环执行命令n次