Skip to content

Instantly share code, notes, and snippets.

@Sketches-su
Last active August 29, 2015 14:14
Show Gist options
  • Save Sketches-su/29e2220f693c2ff37cfe to your computer and use it in GitHub Desktop.
Save Sketches-su/29e2220f693c2ff37cfe to your computer and use it in GitHub Desktop.
A set of small console shortcuts in one script
#!/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