From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e219d94b946dfc26 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Ada.Command_Line and wildcards Date: Tue, 06 Mar 2007 07:08:33 -0800 Organization: Jacob's private Usenet server Message-ID: References: <45dcaed8_6@news.bluewin.ch> <1172132169.423514.271890@s48g2000cws.googlegroups.com> <545bgvF1ttrphU1@mid.individual.net> <1495406.QZvfpqijrQ@linux1.krischik.com> <6dy7mn3hhu.fsf@hod.lan.m-e-leypold.de> <1172328891.5496.62.camel@localhost.localdomain> <1173096982.3712.37.camel@localhost> <8utzwzzv0v.fsf@hod.lan.m-e-leypold.de> <1173185771.11841.69.camel@localhost> NNTP-Posting-Host: adsl-66-218-47-243.dslextreme.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: jacob-sparre.dk 1173194426 11645 66.218.47.243 (6 Mar 2007 15:20:26 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 6 Mar 2007 15:20:26 +0000 (UTC) User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:HxW/VDkchVNbT6dvO4G36TCcim4= Xref: g2news2.google.com comp.lang.ada:9723 Date: 2007-03-06T07:08:33-08:00 List-Id: Georg Bauhaus wrote: > Unlike Ada, Unix favors the *writer* over the reader. No surprise I > think. But damn right? Considering that the Unix shell is created for _interactive_ use, this is certainly not a surprise. But with our new, fancy, interactive shells (like Zsh) it may be time to paraphrase Preben Randhol's signature: Saving keystrokes is the job of the interactive shell, not the programming language. With GNU tools I generally use the long version of the command line arguments. In interactive use it is not significantly (if at all) slower than the short versions, since Zsh helps quite a lot. And in programs it improves readability. > When it comes to echo *.ads, a decision was necessary as to what > should happen when there is no matching file name. The choice was > not: reflect this fact and produce the empty result. Which might have been nice. > I wouldn't mind programs that just read their arguments unexpanded > and call the OS expansion service, an iteration device for example. If that is _the_ way to scan a directory for files, it may be possible to get (practically) all programmers to use it, and thus give a uniform file name pattern expansion service. But what rules should this uniform service follow? Just plain old fashioned globbing? Or the extended Zsh version? Or something completely different? Can we make the pattern matcher user selectable? (Programs would of course have to select one, to work consistently with internal patterns.) > And if there is no matching thing, then *every* program consistently > produces empty results! Yes. :-) > One difference, then, is that an ls will consistently produce > nothing for no argument. This will require more typing when you want > something, for example ls -d "*". Couldn't one just expand the rules for "ls", so calling it with the name of a directory corresponds to "ls /*" (in globbing terms)? Since no explicit directory means ".", then "ls" will correspond to "ls ./*" and work like the more lazy of us would like it to. This would be different from calling "echo" without any arguments. But it would be so because of the _meaning_ of the arguments. > I don't think any Unix programmer will see the benefits of more > typing. But having gone some way through the Ada experience I think > this the right thing. With a sufficiently smart interactive shell, we can probably cut down on the typing at the same time as we improve the handling of big directories. > Or with this change, if calls to the expansion service should not be > part of Unix programs, why not have > > $ ls $(expand "*.ads") Much too long to type. And it wouldn't solve the "too many arguments" problem. If there should be configurable file name pattern matching, I would rather do it using an environment variable: FILE_NAME_EXPANSION=globbing ls *.ads > (I'm not a fan of large directories when we do have a hierarchical > filing system, but again, who am I to suggest that a program be > redesigned to use a hierarchy of directories for file storage.) When I store more than 10_000 messages from comp.lang.ada; how should I distribute them in a hierarchy of directories? I might for example need to grep them for Preben's signature. > For large jobs, ed(1) is the most efficient editor For some reason I just use vi(1) and sed(1). Greetings, Jacob -- �When in Rome; burn it� -- Diziet Sma