root/trunk/bin/with_cat @ 14947
1 | 1380 | aaronmk | #!/bin/bash
|
---|---|---|---|
2 | # Runs a command, taking input from the concatenation of the given files
|
||
3 | 1449 | aaronmk | # Usage: env [cat=...] self file... -- command args...
|
4 | 1380 | aaronmk | |
5 | 1449 | aaronmk | test -n "$cat" || cat=cat |
6 | |||
7 | 1380 | aaronmk | 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 | 1449 | aaronmk | "$cat" "${files[@]}"|"$@" |