Automaticlly change directory to the folder after git clone
curl https://raw.githubusercontent.com/loatheb/git-clone-hook/master/index.sh | bash
Thanks how-to-cd-automatically-after-git-clone for giving me inspiration.
It's really hard for me to command cd
somewhere everytime after git clone
.So I want to find a way to do it automatically.
The question above have many solutions, but they all need I to add them in ~/.zshrc
or ~/.bashrc
by myself.So I write this simple script to detect and write the main function whenever you use bash or zsh.
some commands are use
basename
it will delete any prefix up to the last slash ('/') character and return the result.
mktemp
it will creates a temporary file or directory.
tee
it reads standard input and writes it to both standard output and one or more files, effectively duplicating its input.