-
-
Save ChrisPenner/0e854f7cd79d7f0e053cc87fb6cb8dcb to your computer and use it in GitHub Desktop.
Copy-pasta commands
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 | |
# Use at your own risk :P | |
FOLDER="/tmp/copy-pasta" | |
if [ $# -lt 1 ]; then | |
cat << EOF | |
usage: copy <files> | |
EOF | |
exit 1 | |
fi | |
if [ -d $FOLDER ]; then | |
rm -rf ${FOLDER:?}/* | |
else | |
mkdir $FOLDER | |
fi | |
cp -r "$@" $FOLDER |
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 | |
# Use at your own risk :P | |
FOLDER="/tmp/copy-pasta" | |
if [ $# -gt 1 ]; then | |
cat << EOF | |
usage: pasta <destination dir> | |
EOF | |
exit 1 | |
elif [ $# == 0 ]; then | |
DEST="." | |
else | |
DEST="$1" | |
fi | |
if [ ! -d $FOLDER ]; then | |
cat << EOF | |
Remember to copy before you pasta! | |
EOF | |
exit 1 | |
fi | |
cp -r "$FOLDER"/* "$DEST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment