shift
is a bash
built-in which kind of removes arguments in beginning of the argument list.
[son@test]$ ./test_shift.sh a b c d
-d a -d b -d c -d d
[son@ test]$ cat test_shift.sh
#! /bin/bash
for i in `seq 1 $#`; do
DOMAIN="$DOMAIN -d $1"
shift 1
done
echo $DOMAIN
$# = number of arguments. Answer is 3
$@ = what parameters were passed. Answer is 1 2 3
$? = was last command successful. Answer is 0 which means 'yes'