On Mon, Oct 5, 2009 at 3:20 AM, Sam Watkins <[email protected]> wrote:
>> you're retaining the inconsistency, but candy-coating it.
>
> No, I'm offering a simple syntax using which one can avoid the inconsistency.
> I'm retaining the option to have inconsistent behaviour, for backward
> compatibility, and because some people seem to like it for command-line use.
>
>  cat *      # still ok, will break if no files match, or a file called -v etc
>  cat -- *   # more reliable  (so long as * returns empty if it fails to match)
>
> The new syntax comes for free with `--', which is the standard syntax used by
> almost all programs that take options and also process one or more files named
> on the command line.  `--' is needed so that these programs can cope with
> filenames starting with a dash like `-README-' for example, and not confuse
> them with options.  All serious scripters should be using this `--' already,
> especially if they are doing sysadmin work, otherwise their scripts may break
> or go on a rampage deleting stuff when some user makes a file called `-rf'.
>

the way you usually deal with this is by prefixing the files with "./"
as in rm -fr ./-fr

if that doesn't work you can always use basename(1) or even pwd(1)...

-- 
Federico G. Benavento

Reply via email to