dir names have different upper/lowercase between pwd output and commandprompt?

Discussion in 'Apple' started by Put 030516 in email subj to get thru, Nov 2, 2003.

  1. I'm seeing the following weirdness on my OS X 10.2.6 G4:
    In the first line, the shell prompt is displaying what it thinks is the
    current directory. In the 2nd line, the output of the "pwd" command is
    displaying what it thinks the current directory is. (note, <username>
    replaced my real username for security reasons)

    How come the "pwd" output has converted the first char of my directory
    names to upper case?

    After noticing this, I tried doing "cd" command using upper and lower
    case versions of the dir names, and *both* worked! I never realized
    that the OS X command line shell played games with upper/lowercase like
    this. Note, if you cd to a directory using wildcards, the "1st dir
    letter is uppercase" version of the dir names is needed.

    Normally I wouldn't care, but I've been playing with Java applets where
    I keep the code under my login dir tree, and use softlinks (ln -s) under
    the /Library/WebServer/Documents (or /library/webserver/documents) to
    point back to the actually html & class files. When I get the case
    wrong on the directories in the "ln -s" command, the file isn't found.

    Put 030516 in email subj to get thru, Nov 2, 2003
    1. Advertisements

  2. This quaint behaviour is caused by a design bug[1] in the filesystem used
    by MacOS. It preserves the case of the filenames, but accepts both
    upper and lower case when looking for/opening files.

    If you try "cd /projects/myjava/" at the command line then the
    filesystem will accept this as if you had typed "cd /Projects/MyJava/",
    the shell, however, doesn't know that the filesystem lied and believes
    that /projects/myjava/ exists and shows it in the prompt string.

    [1] The file "straßen" can be opened as "straßen" or as the incorrect
    upper case version "STRAßEN", but not as its proper upper case
    version "STRASSEN".
    Goran Larsson, Nov 2, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.