はじめに
人間は必ずミスを犯すものです。
少しでもミスを減らす為、出来ることはしましょう。
他にいい案があれば教えていただけると嬉しいです。
(Ubuntu版はこちら)
環境
macOSにデフォルトで入っているTerminal
スクリプト
少しでもミスを減らしたいのでaliasでコマンドを置き換えるなどせず、環境毎にスクリプトを作成するのがいいと思っているのでそれ用のスクリプトです。
適時自分の環境に書き換えてください。
ssh_color_change_macos.sh
# !/bin/bash
# ssh connection script
################################################
# style guide
# http://google.github.io/styleguide/shell.xml
################################################
# default profile list
## Basic
## Man Page
## Ocean
## Red Sands
## Silver Aerogel
## Solid Colors
################################################
# profile change function
# Globals:
# None
# Arguments:
# profile name
# Returns:
# None
################################################
function profile_change() {
profile_name=$1
/usr/bin/osascript -e "tell application \"Terminal\" to set current settings of first window to settings set \"${profile_name}\""
}
# Ctr-c processing
# default terminal profile
trap "profile_change \"Basic\"" 2
profile_change "Red Sands"
# command
ssh username@hostname
# end
profile_change "Basic"
exit 0