[[email protected] shell]# cat shift.sh
#!/bin/bash
until [ $# -eq 0 ];do
echo "the first is:$1 total is $#"
shift
done
[[email protected] shell]# ./shift.sh 1 2 3 4 5 6
the first is:1 total is 6
the first is:2 total is 5
the first is:3 total is 4
the first is:4 total is 3
the first is:5 total is 2
the first is:6 total is 1
[[email protected] shell]# cat shiftest.sh
#!/bin/bash
until [ -z "$1" ]
do
echo "[email protected] "
shift
done
[[email protected] shell]# ./shiftest.sh 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8 9
3 4 5 6 7 8 9
4 5 6 7 8 9
5 6 7 8 9
6 7 8 9
7 8 9
8 9
9
时间: 2024-11-05 04:03:44