Created
July 16, 2015 20:34
-
-
Save rbarros/a9b57ff25ea95ed708cf to your computer and use it in GitHub Desktop.
Script para configuração do git-ftp.
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 | |
# Ramon Barros | |
# contato [a] ramon-barros.com | |
# v0.1.0 | |
echo "Script para configuração do git-ftp." | |
verlte() { | |
[ "$1" = "`echo -e "$1\n$2" | sort -n | head -n1`" ] | |
} | |
verlt() { | |
[ "$1" = "$2" ] && return 1 || verlte $1 $2 | |
} | |
# git version 1.8.5.2 (Apple Git-48) | |
check() { | |
return verlte git --version 1.0 && echo "yes" || echo "no" | |
} | |
if [ check == "yes" ]; then | |
echo "Git não instalado ou version inferior a 1.0" | |
else | |
# Recupera a url | |
read -p "Digite a url: " url | |
if [ -z "$url" ]; then | |
echo "A url é obrigatória." | |
exit | |
else | |
echo "Url: $url" | |
fi | |
# Recupera o usuário | |
read -p "Digite o usuário: " user | |
if [ -z "$user" ]; then | |
echo "O user é obrigatório." | |
exit | |
else | |
echo "User: $user" | |
fi | |
# Recupera a senha | |
read -p "Digite a senha: " password | |
if [ -z "$password" ]; then | |
echo "A senha é obrigatória." | |
exit | |
else | |
echo "Password: $password" | |
fi | |
echo "$ git config git-ftp.url $url && git config git-ftp.user $user && git config git-ftp.password '$password'" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment