cancel
Showing results for 
Search instead for 
Did you mean: 

BASH escape character

SOLVED
Go to solution
Kenny Chau
Trusted Contributor

BASH escape character

Hi Linux Experts,

I would like to know how to make the escape characters works in the script like below:

#!/bin/bash
echo "Enter date: \c"
read ans

Output is:
Enter date:
_

It will work in the HP-UX 11.0 sh but not in the RH 7.0 bash. How can I make the escape characters works in bash?

Thanks.
Kenny.
Kenny
2 REPLIES
Marcin Golembski_1
Honored Contributor
Solution

Re: BASH escape character

From the top of my head - if you are trying to suppress the newline, I think

echo -e "Enter date: \c"

or

echo -n "Enter date: "

should work. See man bash to make sure...

Kenny Chau
Trusted Contributor

Re: BASH escape character

Thanks Marcin, thanks for your help.

Regards,
Kenny.
Kenny