
我正在嘗試執行命令:
ssh nvidia@ubuntu-ip-address "/opt/ads2/arm-linux64/bin/ads2 svcd &"
到目前為止,它是有效的,只是在"/opt/ads2/arm-linux64/bin/ads2 svcd&"
執行時它會掛在遠端終端機中,除非我輸入 ctrl+c (見下圖)。
所以我正在尋找一個命令,在執行該"/opt/ads2/arm-linux64/bin/ads2 svcd &"
命令後,從遠端終端退出並繼續執行本地bash腳本。
下面是我正在處理的 bash 腳本
#!/usr/bin/env bash
echo "Welcome to ADS2 Session Start..."
while true
do
echo "Starting service Daemon on the targert"
echo "Enter the ip-address of the target"
read x
if [ -z "$x" ]
then
echo "ip-address is empty"
else
echo "Connecting with target..."
if [[ $x =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ || $x =~ ^fdt-c-agx-[0-9][0-
9][0-9][0-9]$ ]]
then
ssh nvidia@"$x" "/opt/ads2/arm-linux64/bin/ads2 svcd &"; exit 0
if ! ssh nvidia@"$x"
then
echo -e "\033[31mconnection failed\e[0m"
else
echo -e "\033[32m connection succeded\e[0m"
break
fi
else
"Make sure the io address in the coorect form"
fi
fi
done