Xref: utzoo comp.unix.wizards:15926 comp.unix.questions:13268 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!indri!nic.MR.NET!hal!ncoast!allbery From: allbery@ncoast.ORG (Brandon S. Allbery) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: unix question: files per directory Message-ID: <13615@ncoast.ORG> Date: 4 May 89 22:54:31 GMT References: <24110@beta.lanl.gov> <4822@macom1.UUCP> <776@helios.toronto.edu> <432@brian386.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Distribution: na Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 42 As quoted from <432@brian386.UUCP> by news@brian386.UUCP (Wm. Brian McCane): +--------------- | >Another thing you may run into is that some UNIX utilities seem to store | >the names of all of the files somewhere before they do anything with them, | | You didn't actually run into a "rm" bug/feature, you hit a shell | FEECHER. The shell expands for the regexp, and then passes the | generated list to the exec'd command as the arguments. "rm" can only | handle a limited number of files, (or it may be the shell will only pass | a limited number, who knows, its a FEECHER after all ;-), so rm then +--------------- Sorry, it's a kernel limitation. The combined size of all elements of argv[] must be less than some size (I have seen 1024, 5120, and 10240 bytes on various systems). This limit is enforced by the execve() system call (from which all the other exec*() calls are derived). If the argument list is longer than this limit, exec() returns an error which the shell (NOT rm) reports back to the user. +--------------- | gave the error message of too many filenames. I would like it if "rm" | were similar to most other commands, ie. you could rm "*", preventing | the expansion of the * to all file names until "rm" got it, but it | returns the message "rm: * non-existent" on my machine, Sys5r3.0. +--------------- Most other WHAT commands? MS-DOS? VMS? *Certainly* not Unix commands. The advantage of making the shell expand wildcards like * is that the code need only be in the shell, and not enlarging the size of every utility which might have to parse filenames. In these days of shared libraries, that may not be as necessary as it used to be; however, having it in one place does insure that all utilities expand filenames in the same consistent way without any extra work on the part of the programmer. ++Brandon -- Brandon S. Allbery, moderator of comp.sources.misc allbery@ncoast.org uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu Send comp.sources.misc submissions to comp-sources-misc@ NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser