diff combine.sh @ 0:b815081988b5 draft default tip

Uploaded
author nml
date Mon, 06 Feb 2017 10:38:14 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/combine.sh	Mon Feb 06 10:38:14 2017 -0500
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+output=$1
+shift
+
+i=1
+
+for var in "$@"
+do 
+	if [[ -s $var ]] ; then
+		( head -q -n 1 $var ) > $output
+		break
+	fi
+	i=$[i+1]
+done
+
+if [ $i -le "$#" ]
+	then
+		( tail -q -n +2  $@ )>> $output
+else
+	exit 5
+fi
+
+