Skip to content

Instantly share code, notes, and snippets.

@vejuhust
Last active December 15, 2015 09:19
Show Gist options
  • Save vejuhust/5237330 to your computer and use it in GitHub Desktop.
Save vejuhust/5237330 to your computer and use it in GitHub Desktop.
print all c code in this folder
#!/bin/sh
TARGETFILE=allinone.c
if [ -e "$TARGETFILE" ]; then
rm -f "$TARGETFILE"
fi
if [ -n "$1" ]; then
printf "$1""\n" >> "$TARGETFILE"
fi
printf "%s\n\n" $(pwd) >> "$TARGETFILE"
for filename in $(ls | sort)
do
if [ "$0" != ./$filename ] && [ "$TARGETFILE" != $filename ]; then
printf "******** %s BEGIN ********\n" $filename >> "$TARGETFILE"
cat $filename >> "$TARGETFILE"
printf "******** %s END ********\n\n\n\n" $filename >> "$TARGETFILE"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment