Created
April 5, 2020 18:15
-
-
Save ChrisPenner/4a4b2b13a8ebaeb3cf0e8ce9c3619976 to your computer and use it in GitHub Desktop.
Copy/Pasta
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