Here is a small bash script. It changes file suffixes:
#! /bin/bash
old_suffix=$1
new_suffix=$2
for f in *.$old_suffix
do
new_name=${f%.*}.$new_suffix
echo Rename $f to $new_name
done
You might use it like this, to rename all of your C files
(ending in .c) to be C++ files (ending in .cpp):
rn c cpp
For this lab, you should:
rn, and try it out
For extra fame & glory, you could:
-n option that doesn’t rename, but just says what it would do
-v option that renames verbosely