Ugly file name

Dennis Pelton x8876 dgp at ncsc1.ATT.COM
Wed May 17 07:34:04 AEST 1989


In article <448 at hsi86.hsi.UUCP>, derek at hsi.UUCP (Derek Lee-Wo) writes:
> In article <1614 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
> :Helpful Hints #1273: if you have a file name containing characters that
> :the shell assigns special significance to, put the file name in single
> :quotes when typing it as a file name:
> :	% rm 'odds&ends'
> 
> This doesn't work for filenames that start with a minus. eg -badfile
> Anyone know how to erase such files with whipping up a short C program?
> Derek Lee-Wo (Co-op),   Health Systems International, New Haven, CT 06511

The construction

# rm foo any-other-file

will remove any-other-file even if it starts with a '-' sign.  This assumes
that either foo does not exist or you don't care if it doesn't exist.  What
happens is that rm assumes, once it gets a non-negative (:-) argument, that
all succeeding arguments are file names.

Dennis Pelton
att.com.UUCP!ncsc5!dgp



More information about the Comp.unix.wizards mailing list