#!/bin/bash # take all the arguments and print in triangular order # ./countdown a b c d e # a b c d e # b c d e # c d e # d e # e # shift: $2 => $1, $3 => $2, $4 => $3 while [ $# -gt 0 ] do echo "$@" shift done # Or with a for loop: # for i in $(seq 1 $num) # do # echo "$@" # shift # done