From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Stalker To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: References: <20091005192428.GA24445@nipl.net> <200910052204.aa92451@salmon.maths.tcd.ie> <13426df10910051922h6d40c1b2u5a8481db9a2a9b64@mail.gmail.com> <4ACB026E.4070409@maht0x0r.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <530.1254857245.1@kryten> Date: Tue, 6 Oct 2009 20:27:25 +0100 Message-ID: <200910062027.ac05515@salmon.maths.tcd.ie> Subject: Re: [9fans] mishandling empty lists - let's fix it Topicbox-Message-UUID: 8223a52c-ead5-11e9-9d60-3106f5b1d025 > just write a single combinator that when applied to a command > makes it behave in the "no non-flag arguments == dont run" way. > Then its just: > > l0 cat $args > l0 chmod +x $args > Tim Newsham This mostly works, but misses a few cases. For example ln, mv, cp a possibly empty list of files to a directory. If someone really wanted to implement this, and I don't, in case that wasn't obvious, then the most efficient way to do it would be to use your combinator for most of the cases and handle the others individually. There is also a problem with identifying non-flag arguments. In foo -x bar is bar a non-flag argument or not? You really have to read the man page of foo to find out whether you are dealing with something like foo [-x user ] file ... or something more like for [-x] file ... -- John Stalker School of Mathematics Trinity College Dublin tel +353 1 896 1983 fax +353 1 896 2282