3 ms·
> A suggestion that was not adopted was to modify true and false to take an optional argument, and true would exit true only if the argument was non-zero, and f
by jolmg 2y ago
> A suggestion that was not adopted was to modify true and false to take an optional argument, and true would exit true only if the argument was non-zero, and false would exit false only if the argument was non-zero:
> while true $(($x > 5 && $y <= 25))
That's good that it wasn't adopted. I think one of the primary points of usefulness of these commands is as substitutes for whatever other commands the admin may like. Like if you want a user to not have a login shell, you can set the shell to /bin/false. fakechroot also uses /bin/true to substitute other commands like systemctl and ischroot.[1] It just works best if true always returns true regardless of arguments, ditto false.
The example use case isn't compelling either. In bash, you'd do this:
while (( $x > 5 && $y <= 25 ))
Wonder why `$(())` is standarized, but apparently `(())` isn't.
[1] https://github.com/dex4er/fakechroot/blob/master/scripts/debootstrap.env.sh https://github.com/dex4er/fakechroot/blob/master/scripts/deb...