Deutsch English Français Italiano |
<uvbegk$2d15c$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Fri, 12 Apr 2024 15:55:30 +0200 Organization: A noiseless patient Spider Lines: 28 Message-ID: <uvbegk$2d15c$1@dont-email.me> References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org> <0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk> <uusur7$2hm6p$1@dont-email.me> <87a5m5hm18.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 12 Apr 2024 15:55:32 +0200 (CEST) Injection-Info: dont-email.me; posting-host="3e64961bc4a57bf84ee9ec3ae5d82c42"; logging-data="2524332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rAiwigbclmgv1H2cx6xhg" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:5S94P1pGa4HXScXxhinWCaAxqeI= In-Reply-To: <87a5m5hm18.fsf@nosuchdomain.example.com> Bytes: 2080 On 07.04.2024 05:46, Keith Thompson wrote: > Lawrence D'Oliveiro <ldo@nz.invalid> 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. You can use only built-ins, e.g. along the line of set * ; nfiles=$# (It's not only faster but also has less issues.) Janis > 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. > > [...] >