added simple xargs script

This commit is contained in:
aiju 2011-05-11 14:12:25 +00:00
parent ac2e6cf020
commit 2b5b3b9ec4

21
rc/bin/xargs Executable file
View file

@ -0,0 +1,21 @@
#!/bin/rc
fn usage {
echo usage: $0 [-n num] program [arguments]
exit usage
}
rfork e
ifs='
'
nargs=1
while(~ $1 -*) {
switch($1) {
case -n
nargs=$2
shift 2
case *
echo bla
usage
}
}
while(x = `{read -n $nargs})
$* $x