This is the answer to Detective: Renaming files
First, I did have a little hint here: I knew this customer had
been thinking about buying a Mac. But the reason his files
were being clobbered has to do with Mac's HFS+ file system:
"Apple" and "apple" are NOT two different files. If
he had begun his script with "set -o noclobber", Bash would
have refused to overwrite, but as written, the "> $j" cleared
out each file before the "sed" even ran.
Apple does have an optional HFSX file system which can be
case sensitive. It isn't necessarily: Apple Tech Note TN1150 says:
An HFSX volume may be either case-sensitive or case-insensitive. Case sensitivity (or lack thereof) is global to the volume; the setting applies to all file and directory names on the volume. To determine whether an HFSX volume is case-sensitive, use the keyCompareType field of the B-tree header of the catalog file. A value of kHFSBinaryCompare means the volume is case-sensitive. A value of kHFSCaseFolding means the volume is case-insensitive.
Note:
Do not assume that an HFSX volume is case-sensitive. Always use the keyCompareType to determine case-sensitivity or case-insensitivity.
Got something to add? Send me email.
More Articles by Anthony Lawrence © 2011-04-30 Anthony Lawrence
Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. (Donald Knuth)
Printer Friendly Version
Renaming files Copyright © November 2006 Tony Lawrence
Have you tried Searching this site?
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.
Contact us
Printer Friendly Version