Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Created November 13, 2015 16:52
Show Gist options
  • Select an option

  • Save mikekavouras/ff1354377baf576aff82 to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/ff1354377baf576aff82 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ! $2 ]; then
echo "$ ./github.sh *repository_name* ./username.txt"
exit 0
fi
rootpath=~/Desktop/repos/$1;
if [ ! -d ${rootpath} ]
then
mkdir $rootpath
fi
if [ ${2: -4} == ".txt" ]; then
IFS=$'\r\n' GLOBIGNORE='*' :; names=($(cat $2))
for i in "${!names[@]}"; do
if [ ! -d ${rootpath}/${names[$i]} ]; then
path="https://github.com/"${names[$i]}"/"$1".git"
git clone $path ${rootpath}/${names[$i]}
fi
done
else
path="https://github.com/"$2"/"$1".git"
if [ ! -d ${rootpath}/$2} ]; then
git clone $path ${rootpath}/$2
else
echo "directory already exists for this user"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment