#!/bin/sh date=`date +%d%m%Y` for x in $* <---- here's the only change needed! do y=`basename $x` tar czvf $y-${date}.tar.gz $x done