#!/bin/bash if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat < Modified by Mathias Bynens EOF exit; fi APPNAME=${2:-$(basename "$1" ".sh")} DIR="$APPNAME.app/Contents/MacOS" if [ -a "$APPNAME.app" ]; then echo "$PWD/$APPNAME.app already exists :(" exit 1 fi mkdir -p "$DIR" cp "$1" "$DIR/$APPNAME" chmod +x "$DIR/$APPNAME" echo "$PWD/$APPNAME.app"