#!/bin/bash for i in `seq 1 5` do echo $i if [ $i -eq 3 ] then exit fi echo $i done echo aaaaaaa
[root@hf-01 shell]# sh exit.sh 1 1 2 2 3 [root@hf-01 shell]#