#!/bin/sh push_to_remote() { git add --all git commit && git push -u origin } [ -z "$1" ] && { push_to_remote; exit; } for dir in "$@"; do cd "$dir" || exit push_to_remote done