Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for June 20, 2013
Pencil, Pencil, and Pencil
Dividing the Linux desktop
LWN.net Weekly Edition for June 13, 2013
A report from pgCon 2013
Evolution of shells in Linux (developerWorks)
Posted Dec 9, 2011 7:33 UTC (Fri) by ekj (guest, #1524)
ls -- -l
You don't need to use -- for the purpose, but you need to do *something* since both are valid and reasonable commands, but the two have distinct meaning.
Posted Dec 9, 2011 8:52 UTC (Fri) by HelloWorld (guest, #56129)
Posted Dec 9, 2011 12:19 UTC (Fri) by nix (subscriber, #2304)
Posted Dec 9, 2011 12:38 UTC (Fri) by HelloWorld (guest, #56129)
touch -- --harmful-flag
Posted Dec 9, 2011 16:30 UTC (Fri) by nybble41 (subscriber, #55106)
There's a standard solution to this: instead of "ls *.c", write "ls ./*.c", which has the same effect, and yet has no chance of accidentally expanding to an option rather than the expected filename.
Or, for any program which has a standard getopt-style command-line parser, just use "--" before any glob patterns.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds