Last active
May 28, 2019 11:35
-
-
Save kallmanation/8f26464cadfa3eaeaf2c3c3b0f7e4918 to your computer and use it in GitHub Desktop.
A simple file-driven concatenation command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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