Filenames with a $ in it

From: Pascal J.Bourguignon (pjb_at_informatimago.com)
Date: 11/27/03

  • Next message: Robert Khachikyan: "scp from openssh -> ssh.com?"
    Date: Thu, 27 Nov 2003 00:55:45 +0100
    To: "Dan Gapinski" <dangapinski@qsi-r2.com>
    
    

    Dan Gapinski writes:
    > Hello,
    >
    > This might be a UNIX idiocyncracy, but are there any limitations that
    > restrict a filename from having a $ in it? It appears that if we copy a
    > so-named file using SCP, the file cannot be opened or copied. In Windows
    > this is completely legal, so I had to ask.

    There are only two characters that would be very very hard to put in a
    file name: '/' and '\0'. (char)47 and (char)0.

    '$' is a perfect normal character for a file name:

    % mkdir tmp ; cd tmp ; touch '$20.00' "The dollar sign is: '\$'."
    % /bin/ls -1
    $20.00
    The dollar sign is: '$'.

    Of course, you'll have remarked the quoting, since in the usual shells
    a dollar sign may denote the value of a variable.

    I've got no problem to copy such files:

    % scp localhost:/tmp/tmp/* .
    $20.00 100% |******************************| 0 00:00
    The dollar sign is: 100% |******************************| 0 00:00
    % /bin/ls -1
    $20.00
    The dollar sign is: '$'.
    % cp '$20.00' twenty-dollars
    % /bin/ls -1
    $20.00
    The dollar sign is: '$'.
    twenty-dollars
    %

    -- 
    __Pascal_Bourguignon__                          http://www.informatimago.com/   
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Living free in Alaska or in Siberia, a grizzli's life expectancy is 35 years,
    but no more than 8 years in captivity.           http://www.theadvocates.org/
    

  • Next message: Robert Khachikyan: "scp from openssh -> ssh.com?"