Created
May 23, 2022 15:37
-
-
Save ThePyProgrammer/a77945366edee96f67923f351090cc29 to your computer and use it in GitHub Desktop.
A simple shell script to simplify the cloning process.
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
if (( $# == 1 )); then | |
# if only one argument is given (that is that directory = name of repo) | |
git clone $1 | |
repo=$1 | |
repo2arr=(${repo//// }) # split string into list by `/` | |
gitname=${repo2arr[-1]} # get last value | |
git2arr=(${gitname//./ }) # split by `.` | |
name=${git2arr[0]} # get first place | |
echo "Created repo at $name" | |
cd $name # move into directory | |
fi | |
if (( $# == 2 )); then | |
# if two arguments are used | |
git clone $1 $2 | |
cd $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
May I clarify as to which OS you are currently operating on? This is, of course, a very Bash-focused thing. I use Windows, so I have been adapting it to Git Bash, but it's possible that it's not exactly applicable for other OS
.bashrc
s.