1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ssh接続する際にTerminalの色を変える(macOS版)

Last updated at Posted at 2020-01-31

はじめに

人間は必ずミスを犯すものです。
少しでもミスを減らす為、出来ることはしましょう。
他にいい案があれば教えていただけると嬉しいです。
(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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?