-
-
Save yuki777/4109334 to your computer and use it in GitHub Desktop.
sssh
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 | |
# usage: sssh [server] | |
# "sssh" dependent on "sshpass" | |
ssh_login(){ | |
if [ $# -ne 1 ]; then | |
echo 'usage: sssh [server]' | |
exit | |
fi | |
# sshpassを使ってパスワードをファイル指定して、ssh接続することでパスワード入力の手間を省く | |
$HOME/local/bin/sshpass -f ~/.ssh/hoge_password ssh hoge@$1 | |
} | |
if [ $1 ];then | |
ssh_login $1 | |
else | |
select server in `cat ~/bin/server_list|grep -v "#"` | |
do | |
ssh_login $server | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
実行例1:sssh を実行すると ~/bin/server_list の一覧からserver選択して自動ssh接続
実行例2:sssh $server を実行すると ssh $ssh_user@$server を実行する