Skip to content

Instantly share code, notes, and snippets.

@kallmanation
Last active May 28, 2019
Embed
What would you like to do?
A simple file-driven concatenation command
#!/bin/bash
catdeck() {
if [[ "$#" -eq 0 ]]; then
(>&2 echo "usage: $0 final_file_name.catdeck")
exit 1
fi
OUTPUTFILE=$(echo "$1" | sed 's/\.catdeck//')
echo -n "" > "$OUTPUTFILE"
for FILE in `cat "$1"`; do
2>/dev/null cat "$FILE" >> "$OUTPUTFILE" || echo "$FILE" >> "$OUTPUTFILE"
done
}
catdeck "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment