Skip to content

Instantly share code, notes, and snippets.

@ThePyProgrammer
Created May 23, 2022 15:37
Show Gist options
  • Save ThePyProgrammer/a77945366edee96f67923f351090cc29 to your computer and use it in GitHub Desktop.
Save ThePyProgrammer/a77945366edee96f67923f351090cc29 to your computer and use it in GitHub Desktop.
A simple shell script to simplify the cloning process.
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
@ThePyProgrammer
Copy link
Author

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 .bashrcs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment