#!/bin/bash
cd /data/path/to/file
file=("name_info00" "name_info01" "name_info02" "name_info03" "name_info04" "name_info05" "name_info06")
for f in ${file[@]};
do
echo $(pwd)/$f &
echo "$f finished"
done
echo "完成!"
或循环某段连续数字:
tag=v1.1
docker build -t image_name:$tag .
for myport in {13301..13304}
do
docker stop -t 1 container_$myport
docker rm container_$myport
docker run -d --name container_$myport -e TASK_NAME=mainrec_$myport -p $myport:13031 \
-v /path/suzhuji/dir:/path/docker_container/dir \
image_name:$tag
done
docker rmi `docker images|grep "<none>" | awk '{print $3}'` || echo 'No <none> image'