#! /bin/sh # # open-iterm2.sh # Copyright (C) 2020 Vintage Salt # # Distributed under terms of the MIT license. # if ! pgrep -f "iTerm" > /dev/null 2>&1; then echo "Opening iTerm" exec open -a "/Applications/iTerm.app" elif ! osascript -e 'tell application "iTerm2" to create window with default profile' > /dev/null 2>&1; then echo "Killing iTerm and restarting" killall "iTerm" exec open -a "/Applications/iTerm.app" fi