btocakci
asked on
extension changing
hi!i need to write a shell script which changes the extensions of files in a directory.
For example, if the name of the script is ext.sh then a call such as below
ext.sh c cpp
changes the extensions of files which are "c" to "cpp"..
Need your help, thanks..
For example, if the name of the script is ext.sh then a call such as below
ext.sh c cpp
changes the extensions of files which are "c" to "cpp"..
Need your help, thanks..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi sunnycoder!
which variable is c and which one is cpp??
how can adapt your command as i want? (c to cpp)
which variable is c and which one is cpp??
how can adapt your command as i want? (c to cpp)
>ext.sh c cpp
>changes the extensions of files which are "c" to "cpp"..
$1 is the first argument ... c in your example ... $2 is the second argument ... cpp in your example
>changes the extensions of files which are "c" to "cpp"..
$1 is the first argument ... c in your example ... $2 is the second argument ... cpp in your example
rename .c .cpp *.c
or for another example
rename .txt .text *.txt