I have a bash script on CentOS 7.4 with the following line that lets a user input a variable and then lets them confirm that what they entered is indeed correct:
read -p "Enter the name of the database: " dbname
echo "You entered: $dbname"
read -p "Is that correct? Enter y or n: " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
When I SSH into the CentOS machine from Windows 10 with the Command Prompt app to run the script, sometimes I mistype a letter when inputting the variable and I need to backspace. However, when I try to backspace, the Command Prompt app just types out ^H
.
How can I either modify my script or modify a setting somewhere in CentOS or Windows so that my backspace in this setup will actually be functional?
#!/bin/bash
at the top. I just SSH into it with Windows Command Prompt. AFAIK, there's no other shell installed on the CentOS box. Is it possible that Windows Command Prompt somehow needs to be set up, specified for bash itself?ksh
is the default for CentOS, notbash
?/bin/bash
. I also specify it in the script, anyway.