-
-
Save Sketches-su/29e2220f693c2ff37cfe to your computer and use it in GitHub Desktop.
A set of small console shortcuts in one script
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
#!/bin/bash | |
# A set of console shortcuts. Save it to ~/bin/plz and chmod a+x ~/bin/plz | |
case "$1" in | |
"gi") # Add empty .gitignore to current dir | |
[ -f .gitignore ] || touch .gitignore | |
;; | |
"ht") # Add restricting .htaccess to current dir | |
[ -f .htaccess ] || echo -e "Order Allow,Deny\nDeny From All" > .htaccess | |
;; | |
".git") # Init non-bare GIT repo in current dir | |
if [ ! -d .git ]; then | |
git init | |
git config user.name Sketches | |
git config user.email contact@sketches.su | |
echo "/cgi-bin" >> .git/info/exclude | |
echo "/nbproject" >> .git/info/exclude | |
if [ ! -f .gitignore ]; then | |
touch .gitignore | |
if [ -d vendor ]; then | |
echo "/vendor" >> .gitignore | |
fi | |
echo "!.gitignore" >> .gitignore | |
echo "!.htaccess" >> .gitignore | |
fi | |
fi | |
;; | |
*) | |
echo "Error!" | |
sleep 3 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment