Last active
August 17, 2018 18:29
-
-
Save andymotta/fc9fa41aff249e90468e0acb3b2ad575 to your computer and use it in GitHub Desktop.
Clone or pull git repo in Shell script
This file contains hidden or 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 | |
function clone_pull { | |
DIRECTORY=$(basename "$1" .git) | |
if [ -d "$DIRECTORY" ]; then | |
cd "$DIRECTORY" | |
git pull | |
cd ../ | |
else | |
git clone "$1" | |
fi | |
} | |
clone_pull https://github.com/andymotta/s3-fsnotify-go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment