#!/bin/bash set -eux TEMPLATE_APP="/Applications/WatchDownloadsTemplate.app" NEW_APP="/Applications/DanceVideosOnAirdropDownload.app" SCRIPTS_DIR=$(dirname `realpath ${BASH_SOURCE[0]}`) rm -rf "$NEW_APP" cp -R "$TEMPLATE_APP" "$NEW_APP" sed -i '' "s|echo hello world|${SCRIPTS_DIR}/onAirdropDownload.sh|g" "$NEW_APP/Contents/document.wflow" launchctl unload ~/Library/LaunchAgents/com.user.watchdownloads.plist | : cp ${SCRIPTS_DIR}/com.user.watchdownloads.plist ~/Library/LaunchAgents/com.user.watchdownloads.plist launchctl load ~/Library/LaunchAgents/com.user.watchdownloads.plist # launchctl list | grep watchdownloads launchctl start com.user.watchdownloads