#!/bin/bash set -e if [ $# -lt 2 ]; then echo "$0 [-y] suffix initcounter" exit fi suffix=$1 move=no if [ z"$suffix" = "z-y" ]; then shift suffix=$1 move=yes fi j=$2 shift 2 for i in $* do new="${j}_${suffix}.avi" echo "$i -> $new" if [ $move = yes ]; then mv $i $new fi j=`expr $j + 1` done