0
0

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 3 years have passed since last update.

多段ホスト時の変数格納

Posted at

メモ

  • じぶん用のただのメモ書き
  • 実際に挙動見てないのでできるかどうかを確かめる (無理かも。。。)
memo
#!/bin/bash -e
read -a ssh
echo ""
for i in ${ssh[@]}
do
host=$(ssh -t ${LLLLLLL} ssh ${i} exec hostname)
echo ${host} >/dev/null 2>$1
if [ ${host} = "x" ]; then
   hostx=${host}
   echo $hostx
elif [ ${host} = "y" ]; then
   hosty=${host}
   echo $hosty
elif [ ${host} = "a" ]; then
   hosta=${host}
   echo $hosta
elif { ${host} = "b" ]; then
   hostb=${host}
fi
done

echo $hostx
echo $hosty
echo $hosta
echo $hostb
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?