Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Created September 18, 2009 08:23
Show Gist options
  • Save sheldonh/188943 to your computer and use it in GitHub Desktop.
Save sheldonh/188943 to your computer and use it in GitHub Desktop.
Index: files/usr/local/bin/concatsnippets.sh
===================================================================
--- files/usr/local/bin/concatsnippets.sh (revision 1191)
+++ files/usr/local/bin/concatsnippets.sh (working copy)
@@ -84,8 +84,14 @@
cd ${WORKDIR}
# find all the files in the snippets directory, sort them numerically and concat to snippets.concat in the working dir
-/usr/bin/find snippets/ -type f -print0 |/usr/bin/sort ${SORTARG}|/usr/bin/xargs -0 /bin/cat >|"snippets.concat"
+rm -f snippets.concat
+/usr/bin/find snippets/ -type f -print0 |/usr/bin/sort ${SORTARG}|/usr/bin/xargs -0 --no-run-if-empty /bin/cat >|"snippets.concat"
+if [ ! -e "snippets.concat" ]; then
+ echo "No snippets found for ${OUTFILE}"
+ exit 1
+fi
+
if [ x${TEST} = "x" ]; then
# This is a real run, copy the file to outfile
/bin/cp snippets.concat ${OUTFILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment