read
I finally managed to complete the bash script I wanted to have. I wanted to batch rename files in the form of “prefixNUMBERsuffix”. E.g asd.jpg, dfe.jpg to cats_1.jpg, cats_2.jpg ,etc. And yeah.. that is for my gallery in the blog. So here it goes…
#!/bin/bash
if (($# != 4));
then
echo "Usage: pcrename [prefix] [first_number] [suffix] "[mask]""
echo "Example: pcrename fun_ 1 .jpg "*.jpg""
else
prefix=$1
i=$2
suffix=$3
mask=$4
for fname in $mask
do
mv "${fname}" "${prefix}${i}${suffix}"
((i++))
done
fi
P.S My conclusion is that I don’t like bash scripting at all. It hurts my brain!!!