hiro dixit:
>one more reason to use use proper plan9: bourne shell sucks a lot
>compared to rc.
Well nobody uses bourne shell (that thing with U+0060 for COMSUBs
and ^ instead of | as pipe character) any more.
Welcome to the 21ₛₜ century.
Although I freely admit that POSIX shell also sucks and
one more reason to use use proper plan9: bourne shell sucks a lot
compared to rc.
You could just use sed 10q file.
> Is this a matter of efficiency alone?
The C implementation is straightforward and short. It doesn't get
simpler if you wrote it in a higher level language. Your shell script
is IMO much harder to understand.
On 07/07/2013, Markus Teich wrote:
>> Why are these in C?
>
> Because shell scripts tend to run many processes compared to only one
> if you don't fork in the C code?
Is this a matter of efficiency alone?
Why are these in C?
Because shell scripts tend to run many processes compared to only one
if you don't fork in the C code?
--Markus
Strake dixit:
>shift $(dc -e "$OPTIND 1 - p");
*what*?!
shift $(($OPTIND-1)) is POSIX.
bye,
//mirabilos
--
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider
I see some utilities in sbase what could easily be shorter as
shell/awk scripts. Some utilities I sent in earlier, e.g. cut, were
turned down for this reason.
For examples, head:
#!/bin/sh
n=10;
while getopts 'n:' o; do
case $o in
(n) n="$OPTARG";;
esac
done