annotate combine.sh @ 0:b815081988b5 draft default tip

Uploaded
author nml
date Mon, 06 Feb 2017 10:38:14 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b815081988b5 Uploaded
nml
parents:
diff changeset
1 #!/bin/bash
b815081988b5 Uploaded
nml
parents:
diff changeset
2
b815081988b5 Uploaded
nml
parents:
diff changeset
3 output=$1
b815081988b5 Uploaded
nml
parents:
diff changeset
4 shift
b815081988b5 Uploaded
nml
parents:
diff changeset
5
b815081988b5 Uploaded
nml
parents:
diff changeset
6 i=1
b815081988b5 Uploaded
nml
parents:
diff changeset
7
b815081988b5 Uploaded
nml
parents:
diff changeset
8 for var in "$@"
b815081988b5 Uploaded
nml
parents:
diff changeset
9 do
b815081988b5 Uploaded
nml
parents:
diff changeset
10 if [[ -s $var ]] ; then
b815081988b5 Uploaded
nml
parents:
diff changeset
11 ( head -q -n 1 $var ) > $output
b815081988b5 Uploaded
nml
parents:
diff changeset
12 break
b815081988b5 Uploaded
nml
parents:
diff changeset
13 fi
b815081988b5 Uploaded
nml
parents:
diff changeset
14 i=$[i+1]
b815081988b5 Uploaded
nml
parents:
diff changeset
15 done
b815081988b5 Uploaded
nml
parents:
diff changeset
16
b815081988b5 Uploaded
nml
parents:
diff changeset
17 if [ $i -le "$#" ]
b815081988b5 Uploaded
nml
parents:
diff changeset
18 then
b815081988b5 Uploaded
nml
parents:
diff changeset
19 ( tail -q -n +2 $@ )>> $output
b815081988b5 Uploaded
nml
parents:
diff changeset
20 else
b815081988b5 Uploaded
nml
parents:
diff changeset
21 exit 5
b815081988b5 Uploaded
nml
parents:
diff changeset
22 fi
b815081988b5 Uploaded
nml
parents:
diff changeset
23
b815081988b5 Uploaded
nml
parents:
diff changeset
24