If I use "read -s" it deletes the existing line and brings the next prompt to the same line as mentioned below. Please let me know any solution to this error. I need to use "-s" with read not to echo the password on the screen.
script:
$ 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
Current Output:
$ ./a.sh
Enter the db name : ora
Enter the db username: system
Enter the db password: Enter the target database username:
Desired Output:
$ ./a.sh
Enter the db name : ora
Enter the db username: system
Enter the db password:
Enter the target database username:
I am using Linux.
./a.sh
so it isn't clear what shell will be running it. What shell do you use?