Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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