Proposal for a new applet: strings

Roberto A. Foglietta roberto.foglietta at gmail.com
Sat Jul 22 02:10:31 UTC 2023


On Sat, 22 Jul 2023 at 03:36, Roberto A. Foglietta
<roberto.foglietta at gmail.com> wrote:
>
> On Fri, 21 Jul 2023 at 22:37, tito <farmatito at tiscali.it> wrote:
> >
> > On Fri, 21 Jul 2023 21:39:57 +0200
> > "Roberto A. Foglietta" <roberto.foglietta at gmail.com> wrote:

[...]

ERRATA CORRIGE

> rm -f 1.txt; cmd="cat /usr/bin/busybox | ../redfishos/recovery/strings strings";
> stats "$cmd "; stats "$cmd" >/dev/null; stats "$cmd" >1.txt

The first row above is wrong, it should be

rm -f 1.txt; cmd="cat /usr/bin/busybox | ../redfishos/recovery/strings";

However looking at the results, it was used correctly in the tests:

>
> cat /usr/bin/busybox | ../redfishos/recovery/strings
> min: 0m0.041s
> avg: 0m0.050s
> max: 0m0.082s
>

Simply, I did not update my notes after having fixed it on the command line.

Here below a quick test suite for 4 meaningful cases:

bbcmd=$(which busybox)

rm -f 1.txt; cmd="$bbcmd strings $bbcmd";
stats "$cmd "; stats "$cmd" >/dev/null; stats "$cmd" >1.txt

rm -f 1.txt; cmd="cat $bbcmd | $bbcmd strings";
stats "$cmd "; stats "$cmd" >/dev/null; stats "$cmd" >1.txt

rm -f 1.txt; cmd="./strings $bbcmd";
stats "$cmd "; stats "$cmd" >/dev/null; stats "$cmd" >1.txt

rm -f 1.txt; cmd="cat $bbcmd | ./strings";
stats "$cmd "; stats "$cmd" >/dev/null; stats "$cmd" >1.txt

You can easily replace the system busybox with your compiled version.

Finally, the stats() functions should use tmpfile=$(mktemp) instead of
t.time, just in case someone wishes to adopt it for general use. In
this case it is (c) 2023, me under GPLv2, as well.


More information about the busybox mailing list