added simple xargs script
This commit is contained in:
parent
ac2e6cf020
commit
2b5b3b9ec4
1 changed files with 21 additions and 0 deletions
21
rc/bin/xargs
Executable file
21
rc/bin/xargs
Executable 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
|
Loading…
Reference in a new issue