help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: removing file with newlines in name


From: Frederik Fouvry
Subject: Re: removing file with newlines in name
Date: Tue, 30 Nov 2004 18:09:19 +0100
User-agent: Emacs Gnus

,-- One day, you wrote:
| 

[...]

| Quotation marks are your friend.
| 
| rm "case 't':   get_all_tables = 1;
|                         break;
|             case 'T':   get_all_tables = 2;
| cd"
| 
| does what you want. You don't need to type all that, just paste it
| between two quotes.
| 
| And you were wondering why shells support two types of quotes...

If only ... Thanks for the suggestion, but ... it doesn't work.  It
seems that the interpretation of the name goes wrong:

$ rm "case 't':   get_all_tables = 1;\
                        break;\
            case 'T':   get_all_tables = 2;\
" 
rm: cannot lstat `case \'t\':   get_all_tables = 1;                        
break;\t    case \'T\':   get_all_tables = 2;': No such file or directory

Just the same (well, not quite, it's a tad better: it realises it's a
file) without the backslashes before newlines:

$ rm "case 't':   get_all_tables = 1; 
                        break; 
            case 'T':   get_all_tables = 2; 
" 
rm: cannot lstat `case \'t\':   get_all_tables = 1;\n                        
break;\n\t    case \'T\':   get_all_tables = 2;\n': Invalid argument

Perhaps the problem is that newlines are converted to "\n".  Any idea
on how to prevent this?  I tried all kinds of nifty quoting schemes
for ls, but at some stage, the name is modified to what is shown in
the error messages.

Frederik Fouvry


reply via email to

[Prev in Thread] Current Thread [Next in Thread]