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
Modified: 2009-01-25T15:46 User: Guest Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |