Bash cmd中的WIN10 openssh;sshxxx@xxx.xxx.xxx.xxxsh xxx.sh“;错误,无法正常读取变量

Bash cmd中的WIN10 openssh;sshxxx@xxx.xxx.xxx.xxxsh xxx.sh“;错误,无法正常读取变量,bash,ssh,cmd,openssh,openwrt,Bash,Ssh,Cmd,Openssh,Openwrt,Im Win10并安装了Openssh。我的路由器正在运行Openwrt。代码是通过BASH编写的 !!!代码在这里 flag1=1 option1_1="Its num1" while [[ "$flag1" = "1" ]];do read -n 1 -p "Please input num1 :" input1 case ${input1} in 1) echo . read -n 1 -p "Your input is: $input1,comfi

Im Win10并安装了Openssh。我的路由器正在运行Openwrt。代码是通过BASH编写的

!!!代码在这里

flag1=1
option1_1="Its num1"
while [[ "$flag1" = "1" ]];do
read -n 1  -p "Please input num1    :" input1
case ${input1} in
    1)
      echo .
      read -n 1 -p "Your input is: $input1,comfirm?[1/0]" comfirm1
      if [[ "$comfirm1" = "1" ]];then
         echo .
         echo Your input is $input1,Goodbye
         flag1=0
      fi
  ;;
    *)
     echo Its not num1 ,please input again
     flag1=1
  ;;
esac
done
我的路由器中有一个.sh文件,我需要通过以下步骤运行它:

步骤:

  • Win+R打开cmd.exe
  • 键入以下命令:sshexample@192.168.1.1sh example.sh
  • 问题来了:它不能正常读取变量,也不能输出我在文件中写的字

    但是,如果我使用下面的命令运行此脚本,它将正常工作:

    步骤:

  • Win+R打开cmd.exe
  • 类型:sshexample@192.168.1.1
  • 类型:sh example.sh
  • 问题:(我已将视频上传到Youtube:)

    它应该读取两次“1”并保存到$input1$comfirm1,但实际上它只有在我键入“11”时才能正确读取,其他输入将导致它永远循环

    我注意到了一些事情,但我不知道我能做什么:

    我注意到的事情:

  • 当我使用一个命令“ssh”时xxx@xxx.xxx.xxx.xxxsh xxx.sh”,cmd.exe窗口的标题仍然是“C:\Winodws\system32\cmd.exe-ssh”xxx@xxx.xxx.xxx.xxxsh test.sh.“但是当我将此命令分解为两个命令时,它将更改为“OpenSSH客户端”
  • 当我使用一个命令时,代码
    读取-n1-p“xxx”
    不起作用。它不能显示-p字或仅读取1个字符 谁知道出了什么问题,给我一个建议来解决这个问题