小编Ten*_*uan的帖子

ssh 会话后 case 语句的语法错误

#!/bin/sh

echo -n "Enter the raspberry ip address you want to connect:"
read Rasp_id

sshpass -p "the@Donut" ssh -t -X -oStrictHostKeyChecking=no pi@$Rasp_id << E2
        echo -e "Enter the case you want to echo\n 1.1 a \n 2.1 b"
        read option
        case "\$option" in
        1)
        echo "a"
        ;;

        2)
        echo "b"
        ;;
esac
E2
Run Code Online (Sandbox Code Playgroud)

我正在编写一个启动 ssh 会话然后在远程机器上执行一些修改的脚本,它会给出如下语法错误:

bash: line 3: syntax error near unexpected token `)'
bash: line 3: `        1)'
Run Code Online (Sandbox Code Playgroud)

linux shell bash bourne-shell

1
推荐指数
1
解决办法
85
查看次数

标签 统计

bash ×1

bourne-shell ×1

linux ×1

shell ×1