From 3aab5a522b5789176f3df4e7ca34c34260dfad92 Mon Sep 17 00:00:00 2001 From: "luk.lu" Date: Sat, 8 Oct 2022 20:07:07 +0800 Subject: [PATCH] u --- expect-ssh2server.sh | 51 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/expect-ssh2server.sh b/expect-ssh2server.sh index d778e77..69ff000 100755 --- a/expect-ssh2server.sh +++ b/expect-ssh2server.sh @@ -22,62 +22,23 @@ else echo " de4 : $de4" echo " sh : $sh" echo " wx : $wx" - echo " other : specify host/user/pwd" echo - read -p "Enter target (default to other)>> " TARGET + echo "=== Enter target (leave blank to specify host/user/pwd):" + read -p ">>> " TARGET if [ ! $TARGET ] then TARGET=other fi fi -if [ $TARGET = "local" ] +eval targetUrl=\$${TARGET} + +if [ $targetUrl ] then read -p "Enter adot password (ROAD) >>" PWD_ADOT read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $local adot $PWD_ADOT $PWD_ADOT -elif [ $TARGET = 'us1' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $us1 adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'us2' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $us2 adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'de1' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $de1 adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'de2' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $de2 adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'de3' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $de3 adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'de4' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $de4 adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'sh' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $sh adot $PWD_ADOT $PWD_ROOT -elif [ $TARGET = 'wx' ] -then - read -p "Enter adot password (ROAD) >>" PWD_ADOT - read -p "Enter root password (YU) >>" PWD_ROOT - expect ~/faronear/fon/sysconfig/expect-ssh.sh $wx adot $PWD_ADOT $PWD_ROOT + expect ~/faronear/fon/sysconfig/expect-ssh.sh $targetUrl adot $PWD_ADOT $PWD_ADOT else - echo Other target is selected. Please specify details of the target: while [ ! $HOST ] do read -p "host = " HOST