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

Re: How to escape this for the bash shell...



Quoting Alex Shnitman (alexsh@hectic.net):
> On Wed, Aug 04, 1999 at 01:22:17AM -0600, Nate Duehr wrote:
> 
> > I have a file named :
> > 
> > ?????[4~?[4~?[4~?[4~?[4~?[4~?[4~?[4~?[4~?[4~
> > 
> > ... in my home directory. 
> > 
> > I am wondering how to escape this properly for rm to work on it in
> > bash.
> 
> Most people told you to rm ./file or rm 'file' but that won't work of
> course since you can't input the filename from the keyboard at
> all. (The name as you typed it looks like it consists of escape
> sequences, not something you can easily type on the keyboard.) So it's
> a better idea to use the shell's wildcard expansion to do the work for
> you. You can type rm -i * and then answer n for every file except for
> this one.

In the general case, I think you still need the ./* in case you have
files called -d etc. which would generate undesirable option switches.

I would also assume that rm -i ./*4~ could speed things up. Where the
file name at least starts with printable characters, recognition (<tab>)
can also help as it automatically inserts the necessary backslashes.

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.


Reply to: