help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Is `while :` preferred over `while true`?


From: Chet Ramey
Subject: Re: [Help-bash] Is `while :` preferred over `while true`?
Date: Sun, 4 Mar 2018 16:53:59 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 3/3/18 9:20 AM, Peng Yu wrote:
> Hi,
> 
> When I run the following command, it seems that `while :` is not
> always faster than `while true`. But my understanding is that `while
> true` calls the bash internal command `true` but `while :` does not
> call anything. So I think `while :` should be always better in terms
> of runtime. Is it so? Thanks.

Why would you think they are different? They are both builtins that do
the exact same thing. In fact, they're implemented using the same function.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]