I need following sample bash script to behave as follows:
echo -e "Enter name: \c"
read U_IP_NAME
echo -e "You said your name is : $U_IP_NAME"
This will output to:
Enter name: Alok
You said your name is : Alok
But it I want it to be:
You said your name is : Alok
Is there a way to achieve this?
[Solved with solution given by: mouviciel]
You want to move the cursor up one line. This is achieved with tput cuu1
:
echo -e "Enter name: \c"
read U_IP_NAME
tput cuu1
echo -e "Your said your name is : $U_IP_NAME"
More info with man tput
and man terminfo
.
read -p "Enter your uip-name: " U_IP_NAME
-p for prompt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With