[GRASS-user] g.rename in a loop has no real effect

(using GRASS 6.4.svn under Ubuntu 64-bit)

~/PERMANENT/cell > ls -l
total 804220
-rw-r--r-- 1 nik nik 1135311 2008-10-10 04:10 composite_28082007_b742
-rw-r--r-- 1 nik nik 21633788 2008-10-10 02:47
L71183034_03420070828_B10
-rw-r--r-- 1 nik nik 21893170 2008-10-10 02:48
L71183034_03420070828_B20
-rw-r--r-- 1 nik nik 22822290 2008-10-10 02:48
L71183034_03420070828_B30
-rw-r--r-- 1 nik nik 21133756 2008-10-10 02:48
L71183034_03420070828_B40
-rw-r--r-- 1 nik nik 22834132 2008-10-10 02:49
L71183034_03420070828_B50
-rw-r--r-- 1 nik nik 9470878 2008-10-10 02:49
L71183034_03420070828_B61
-rw-r--r-- 1 nik nik 23574756 2008-10-10 02:49
L71184034_03420070904_B10
-rw-r--r-- 1 nik nik 24291516 2008-10-10 02:50
L71184034_03420070904_B20
-rw-r--r-- 1 nik nik 25511638 2008-10-10 02:50
L71184034_03420070904_B30
-rw-r--r-- 1 nik nik 24389358 2008-10-10 02:50
L71184034_03420070904_B40
-rw-r--r-- 1 nik nik 27081802 2008-10-10 02:51
L71184034_03420070904_B50
-rw-r--r-- 1 nik nik 12005030 2008-10-10 02:51
L71184034_03420070904_B61
-rw-r--r-- 1 nik nik 10783979 2008-10-10 00:59
L72183034_03420070828_B62
-rw-r--r-- 1 nik nik 49431852 2008-10-10 00:59
L72183034_03420070828_B70
-rw-r--r-- 1 nik nik 196734858 2008-10-10 00:59
L72183034_03420070828_B80
-rw-r--r-- 1 nik nik 11040917 2008-10-10 00:59
L72184034_03420070904_B62
-rw-r--r-- 1 nik nik 49589402 2008-10-10 01:00
L72184034_03420070904_B70
-rw-r--r-- 1 nik nik 197905262 2008-10-10 01:00
L72184034_03420070904_B80
-rw-r--r-- 1 nik nik 48443802 2008-10-09 23:32 landsat_04092007_b1
-rw-r--r-- 1 nik nik 748160 2008-10-10 02:46 MASK
-rw-r--r-- 1 nik nik 225332 2008-10-10 02:45 StudyArea
[Raster MASK present]

PERMANENT/cell > for x in L7*; do g.rename rast=$x,`echo $x | tr
'[:upper:]' '[:lower:]'`; done
Rename raster <L71183034_03420070828_B10> to <l71183034_03420070828_b10>
Rename raster <L71183034_03420070828_B20> to <l71183034_03420070828_b20>
Rename raster <L71183034_03420070828_B30> to <l71183034_03420070828_b30>
Rename raster <L71183034_03420070828_B40> to <l71183034_03420070828_b40>
Rename raster <L71183034_03420070828_B50> to <l71183034_03420070828_b50>
Rename raster <L71183034_03420070828_B61> to <l71183034_03420070828_b61>
Rename raster <L71184034_03420070904_B10> to <l71184034_03420070904_b10>
Rename raster <L71184034_03420070904_B20> to <l71184034_03420070904_b20>
Rename raster <L71184034_03420070904_B30> to <l71184034_03420070904_b30>
Rename raster <L71184034_03420070904_B40> to <l71184034_03420070904_b40>
Rename raster <L71184034_03420070904_B50> to <l71184034_03420070904_b50>
Rename raster <L71184034_03420070904_B61> to <l71184034_03420070904_b61>
Rename raster <L72183034_03420070828_B62> to <l72183034_03420070828_b62>
Rename raster <L72183034_03420070828_B70> to <l72183034_03420070828_b70>
Rename raster <L72183034_03420070828_B80> to <l72183034_03420070828_b80>
Rename raster <L72184034_03420070904_B62> to <l72184034_03420070904_b62>
Rename raster <L72184034_03420070904_B70> to <l72184034_03420070904_b70>
Rename raster <L72184034_03420070904_B80> to <l72184034_03420070904_b80>
[Raster MASK present]

PERMANENT/cell > ls -l
total 804220
-rw-r--r-- 1 nik nik 1135311 2008-10-10 04:10 composite_28082007_b742
-rw-r--r-- 1 nik nik 21633788 2008-10-10 02:47
L71183034_03420070828_B10
-rw-r--r-- 1 nik nik 21893170 2008-10-10 02:48
L71183034_03420070828_B20
-rw-r--r-- 1 nik nik 22822290 2008-10-10 02:48
L71183034_03420070828_B30
-rw-r--r-- 1 nik nik 21133756 2008-10-10 02:48
L71183034_03420070828_B40
-rw-r--r-- 1 nik nik 22834132 2008-10-10 02:49
L71183034_03420070828_B50
-rw-r--r-- 1 nik nik 9470878 2008-10-10 02:49
L71183034_03420070828_B61
-rw-r--r-- 1 nik nik 23574756 2008-10-10 02:49
L71184034_03420070904_B10
-rw-r--r-- 1 nik nik 24291516 2008-10-10 02:50
L71184034_03420070904_B20
-rw-r--r-- 1 nik nik 25511638 2008-10-10 02:50
L71184034_03420070904_B30
-rw-r--r-- 1 nik nik 24389358 2008-10-10 02:50
L71184034_03420070904_B40
-rw-r--r-- 1 nik nik 27081802 2008-10-10 02:51
L71184034_03420070904_B50
-rw-r--r-- 1 nik nik 12005030 2008-10-10 02:51
L71184034_03420070904_B61
-rw-r--r-- 1 nik nik 10783979 2008-10-10 00:59
L72183034_03420070828_B62
-rw-r--r-- 1 nik nik 49431852 2008-10-10 00:59
L72183034_03420070828_B70
-rw-r--r-- 1 nik nik 196734858 2008-10-10 00:59
L72183034_03420070828_B80
-rw-r--r-- 1 nik nik 11040917 2008-10-10 00:59
L72184034_03420070904_B62
-rw-r--r-- 1 nik nik 49589402 2008-10-10 01:00
L72184034_03420070904_B70
-rw-r--r-- 1 nik nik 197905262 2008-10-10 01:00
L72184034_03420070904_B80
-rw-r--r-- 1 nik nik 48443802 2008-10-09 23:32 landsat_04092007_b1
-rw-r--r-- 1 nik nik 748160 2008-10-10 02:46 MASK
-rw-r--r-- 1 nik nik 225332 2008-10-10 02:45 StudyArea
[Raster MASK present]

Why doesn't it work properly here?
Thank you, Nikos

Nikos Alexandris wrote:

(using GRASS 6.4.svn under Ubuntu 64-bit)

PERMANENT/cell > for x in L7*; do g.rename rast=$x,`echo $x | tr '[:upper:]' '[:lower:]'`; done

Why doesn't it work properly here?

It has nothing to do with the loop. g.rename does nothing if the new
name is the same as the old one, ignoring case.

This check was added relatively recently, to prevent it from
destroying data on filesystems which aren't case sensitive. If you run
the above command on a FAT or NTFS filesystem, it would simply delete
the maps.

[It deletes the destination first; if the destination is the same as
the source (apart from case), then it ends up deleting the source.]

If you want to change the case of your map names, you first need to
rename the map to a name which differs by more than case, then rename
it to the intended name.

--
Glynn Clements <glynn@gclements.plus.com>