Re: [dev] [sbase] shell scripts

2013-07-07 Thread Thorsten Glaser
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

Re: [dev] [sbase] shell scripts

2013-07-07 Thread hiro
one more reason to use use proper plan9: bourne shell sucks a lot compared to rc.

Re: [dev] [sbase] shell scripts

2013-07-07 Thread Jacob Todd
You could just use sed 10q file.

Re: [dev] [sbase] shell scripts

2013-07-07 Thread Joseph Xu
> 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.

Re: [dev] [sbase] shell scripts

2013-07-07 Thread Strake
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?

Re: [dev] [sbase] shell scripts

2013-07-07 Thread Markus Teich
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

Re: [dev] [sbase] shell scripts

2013-07-07 Thread Thorsten Glaser
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

[dev] [sbase] shell scripts

2013-07-07 Thread Strake
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