From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <20091005062048.GD22078@nipl.net> References: <20091004071748.GA16895@nipl.net> <20091005062048.GD22078@nipl.net> Date: Mon, 5 Oct 2009 03:53:32 -0300 Message-ID: <32d987d50910042353r7f3dd271lc4ce388c0d50194a@mail.gmail.com> From: "Federico G. Benavento" To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] mishandling empty lists - let's fix it Topicbox-Message-UUID: 7e64781c-ead5-11e9-9d60-3106f5b1d025 On Mon, Oct 5, 2009 at 3:20 AM, Sam Watkins wrote: >> you're retaining the inconsistency, but candy-coating it. > > No, I'm offering a simple syntax using which one can avoid the inconsiste= ncy. > I'm retaining the option to have inconsistent behaviour, for backward > compatibility, and because some people seem to like it for command-line u= se. > > =C2=A0cat * =C2=A0 =C2=A0 =C2=A0# still ok, will break if no files match,= or a file called -v etc > =C2=A0cat -- * =C2=A0 # more reliable =C2=A0(so long as * returns empty i= f it fails to match) > > The new syntax comes for free with `--', which is the standard syntax use= d by > almost all programs that take options and also process one or more files = named > on the command line. =C2=A0`--' is needed so that these programs can cope= with > filenames starting with a dash like `-README-' for example, and not confu= se > them with options. =C2=A0All serious scripters should be using this `--' = already, > especially if they are doing sysadmin work, otherwise their scripts may b= reak > 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)... --=20 Federico G. Benavento