> >> it is always a bad idea to mix up different languages
> >> in one environment.
> 
> I don't accept this is a valid starting point.  I agree that it is
> useful to limit the number of tools/languages you use, but you
> should
> still try and use the right tool/language for the right job.

your are right. the question is:

original:
sed -ne 's![^0-9].*$!!p' /proc/uptime

patch:
cut -d'.' -f1 /proc/uptime

patch-2:
uptime_in_seconds()
{
        cut -d'.' -f1 /proc/uptime
}

what is the better tool?
what is better readable?
must we really sanitize /proc/uptime for numbers?

> Indeed: /bin/sh was designed around the idea that running an
> external
> command like `sed' is basically equivalent to a function call to

yes, but in practise it is a good idea to use internal
functions/commands (speed, memory).

> a library function.  That's why /bin/sh is very limited in the
> text-handling functionality it provides directly.  So by and

/bin/sh is more limited than sed, but still strong.

> `sed' is part of the /bin/sh language (I've managed to survive 20
> years
> of unix without ever really learning awk, so I don't feel quite as
> strongly about awk as about sed).

i like this sentence 8-)

I will stop sending patches like this, because i see that
many people have stomachache with these, but i propose
for menuconfig a selection like this:

[ ] base-files standard
[ ] base-files mini (no sed/awk, experimental)

bye, Bastian

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to