[TUHS] Origins of globbing

Random832 random832 at fastmail.com
Wed Oct 7 12:25:37 AEST 2020


On Tue, Oct 6, 2020, at 11:17, John Cowan wrote:
> Globbing was uninterpreted by the shell-equivalent in the DEC OSes, and 
> was understood only by a few programs, those responsible for listing 
> directories and copying, renaming, and deleting files.  Universal 
> globbing in the shell was AFAIK original with Unix

it's worth mentioning that "universal" globbing comes with restrictions that operating systems where programs interpret globs don't have: you can't reliably pass a glob as an option argument, or as an argument which refers to files that do not exist in the filesystem, without quoting it, which requires additional quoting when you want a literal * or ? character. Quoting is also required even when the argument position is not semantically a set of filenames at all.

Also, since you mentioned renaming, MS-DOS/Windows, at least, has a primitive 'rename one glob to another' [it has rules that technically give meaning to any destination glob, but it's most sensible when you want to change the filename extension of a set of files] function that's not possible either on Unix [though utilities do exist to perform various transformations on the name of a set of files to be renamed]

Although, sometimes the results can be surprising - the MS-DOS/Windows "copy" command, for example, *concatenates* a globbed set of files [achievable with a list of filenames by separating them with plus signs] rather than copying them separately into a destination directory.


More information about the TUHS mailing list