rm \- "-" ??
Sunday 01 July 2007 at 3:17 pm. Used tags: gnu_coreutils
Does anyone know when really did coreutils get patched for this behavior ?rrs@learner:~$ rm -fooThis feature really wasn't earlier and if you ever ended up with files starting with characters like "-", it was not a straight task to remove it.
rm: invalid option -- o
Try `rm ./-foo' to remove the file `-foo'.
Try `rm --help' for more information.
Earlier (when I wasn't aware of this patch), the workaround was to write a small 1 liner and not use getopt at all. Something like:
rrs@learner:~$ cat rm.pyI'm really happy to see this bug fixed.
#!/usr/bin/env python
import os, sys
sys.stdout.write("Removing file %s.\n" % (sys.argv[1]) )
os.unlink(sys.argv[1])
four comments
Use "--" (2 hyphens) as command line argument, if you've file names starting with "-" in coreutils . à¤à¤œà¥€à¤· जà¥à¤à¥à¤² (URL) - 01-07-’07 22:06