-
-
Save matsu-chara/5d8e2e093ea735a68a683a098bf741d5 to your computer and use it in GitHub Desktop.
iterm2 version 3.0.0 fix error `44:52: syntax error: end of line があるべきところですが identifier が見つかりました。 (-2741)`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/themoriarty/584b759513c5c5864dac | |
# | |
# (1) copy to: ~/bin/ssh-host-color | |
# (2) set: alias ssh=~/bin/ssh-host-color | |
# | |
# Inspired from http://talkfast.org/2011/01/10/ssh-host-color | |
# Fork from https://gist.github.com/773849 | |
# | |
set_term_bgcolor(){ | |
local R=$1 | |
local G=$2 | |
local B=$3 | |
/usr/bin/osascript <<EOF | |
tell application "iTerm" | |
tell current session of current window | |
set background color to {$(($R*65535/255)), $(($G*65535/255)), $(($B*65535/255))} | |
end tell | |
end tell | |
EOF | |
} | |
if [[ "$@" =~ thomd ]]; then | |
set_term_bgcolor 40 0 0 | |
elif [[ "$@" =~ git ]]; then | |
set_term_bgcolor 0 40 0 | |
fi | |
trap "set_term_bgcolor 0 0 0" EXIT | |
ssh $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe current terminal is removed
https://github.com/gnachman/iTerm2/blob/v3.0.0/sources/AppleScriptTest.m#L175-L176