#!/bin/bash # This is just to update my git repo a tiny bit faster usage() { echo "Usage: $0 [-a \"\"] [-s ]" 1>&2; exit 1; } while getopts "a:s:" o; do case "${o}" in a) a=${OPTARG} git add . git commit -m "$a" git push exit 0 ;; s) s=${OPTARG} if [ -f $s ] || [ -d $s ]; then git add $s read -p "Commit message: " commitMsg tmp="${commitMsg%\"}" tmp="${tmp#\"}" git commit -m "$tmp" git push else echo "$s is not a regular file!" exit 1 fi ;; *) usage ;; esac done #shift $((OPTIND-1))