[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: new option affecting * expansion

From: Robert Elz
Subject: Re: RFE: new option affecting * expansion
Date: Tue, 17 Aug 2021 13:43:06 +0700

    Date:        Mon, 16 Aug 2021 22:35:12 -0400
    From:        "Dale R. Worley" <worley@alum.mit.edu>
    Message-ID:  <875yw4yf1b.fsf@hobgoblin.ariadne.com>

  | Back in the old, old days, there was a program named "glob" that did
  | pathname expansions.

That's correct.


  | So you wouldn't say
  |    cat *
  | you'd say
  |    cat $( glob * )

all of that is utter gibberish.   cat * has worked since glob was invented
(which is way back even before my time).   glob was used by the shell to
implement this, and would be run (if I remember correctly) something like

        /etc/glob cat '*'

which would then expand the * (or other pattern, or patterns in the
arg list) and exec argv[1] with argv[1]..argv[n] (after expansion) as
the arg list.

All this allowed a much smaller program than the shell to do the pathname
expansion, so it had enough available memory to fit lots of expanded
pathnames (at least the couple of hundred that the kernel allowed for
arg lists...) - they shell didn't need to include the pattern matching
code (just recognition, so it knew when to invoke glob) and glob didn't
need any parsing code.   There was no concept of PATH, both sh and glob
knew to try /bin/cmd and /usr/bin/cmd when cmd contained no '/' chars.


ps: back when glob existed, there was no form of command substitution
available, certainly not $() which is much more recent, but not even the
older `` form.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]