root/trunk/bin/with_cat @ 14570
1 |
#!/bin/bash
|
---|---|
2 |
# Runs a command, taking input from the concatenation of the given files
|
3 |
# Usage: env [cat=...] self file... -- command args...
|
4 |
|
5 |
test -n "$cat" || cat=cat |
6 |
|
7 |
files=() |
8 |
while test "$#" -ge 0; do |
9 |
if test "$1" = --; then |
10 |
shift |
11 |
break
|
12 |
fi |
13 |
files=("${files[@]}" "$1") |
14 |
shift
|
15 |
done
|
16 |
|
17 |
"$cat" "${files[@]}"|"$@" |