Re: Command Languages Versus Programming Languages

Liste des GroupesRevenir à cu programmer 
Sujet : Re: Command Languages Versus Programming Languages
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.misc
Date : 07. Apr 2024, 05:46:59
Autres entêtes
Organisation : None to speak of
Message-ID : <87a5m5hm18.fsf@nosuchdomain.example.com>
References : 1 2 3 4
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
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.  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 */

Date Sujet#  Auteur
10 Nov 24 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal