如果我使用“read -s”,它将删除现有行并将下一个提示带到同一行,如下所述。请让我知道此错误的任何解决方案。我需要使用“-s”来读取而不是在屏幕上回显密码。
脚本:
$ cat a.sh
printf "Enter the db name : "
read -r sourcedb
printf "Enter the source db username: "
read -r sourceuser
printf "Enter the source database password: "
read -s sourcepwd;
printf "Enter the target database username: "
read -r targetuser
Run Code Online (Sandbox Code Playgroud)
电流输出:
$ ./a.sh
Enter the db name : ora
Enter the db username: system
Enter the db password: Enter the target database username:
Run Code Online (Sandbox Code Playgroud)
期望的输出:
$ ./a.sh
Enter the db name : ora
Enter the …
Run Code Online (Sandbox Code Playgroud)