Skip to content

Instantly share code, notes, and snippets.

@geta6
Created December 4, 2011 03:19
Show Gist options
  • Save geta6/1429028 to your computer and use it in GitHub Desktop.
Save geta6/1429028 to your computer and use it in GitHub Desktop.
ウィンドウが単一のときterminal.appをkillします、bashでも動きます
#!/bin/zsh
alias quit=killterm
killterm(){
_WIN=$(( `w | wc -l`-3 ))
_PID=`ps ax | grep Terminal | grep -v grep | sed -e 's/ *\([0-9]*\).*/\1/g'`
[[ -z ${WINDOW} ]] && [[ 1 -eq ${_WIN} ]] && [[ -n ${_PID} ]] && kill ${_PID}
exit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment