#!/bin/bash OS=$(uname) ECODE=0 if [ "$1" = "" ]; then echo "mshot " fi sleep 0.2 DIR=$(mktemp -d /tmp/mshot.XXXXXXXXXX) if [ "$OS" = "Darwin" ]; then screencapture "$DIR/pic.png" else scrot "$DIR/pic.png" fi mupload "$DIR/pic.png" "img/${1}.png" if [ $? -eq 0 ]; then msound camera-shutter else merror "mshot" "Couldn't upload image file." echo "An error occurred." 1>&2 ECODE=1 fi rm -r "$DIR" exit "$ECODE"