Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Sat, 06 Apr 2024 20:46:59 -0700 Organization: None to speak of Lines: 20 Message-ID: <87a5m5hm18.fsf@nosuchdomain.example.com> References: <87edbtz43p.fsf@tudado.org> <0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 07 Apr 2024 03:47:01 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0efa4b53af11f7d4b5690e9314ba952a"; logging-data="2715303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19d+ya85HRtbCei1Ezsdvj0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:6Cx4OY3zPg+elRT4fvkCW5lAN+U= sha1:pUuOyT4egqriuoxp2zYf31pSFWA= Xref: csiph.com comp.unix.shell:24975 comp.unix.programmer:15718 comp.lang.misc:10392 Lawrence D'Oliveiro writes: > On Sun, 07 Apr 2024 00:01:43 +0000, Javier wrote: > >> The downside is the loss of performance because of disk access for >> trivial things like 'nfiles=$(ls | wc -l)'. > > Well, you could save one process creation by writing > “nfiles=$(echo * | wc -l)” instead. But that would still not be strictly > correct. If that saves a process, it's because echo is builtin. But it will set $nfiles to 1 (unless you happen to have files with newlines in their names). Both skip hidden files, which may or may not be what you want. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */