Escape characters in Bash

Started by
0 comments, last by Muzzafarath 24 years ago
I thought I'd try to write some CGI scripts in Bash (just for fun, of course ), and it works very good. I have a tiny problem though. How do you print escape characters (\n, \t etc.)? All CGI scripts must start with a header which is terminated by two newline characters (\n\n)... I print the header like this (which works): echo "Content-type: text/html " But I'd like to do it the way you would do it in C (and many other languages): echo "Content-type: text/html\n\n" That won't work Any ideas? (As you might have guessed, I'm not very familiar with bash ). Edited by - Muzzafarath on 8/9/00 2:51:15 PM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Advertisement
Nevermind... A quick look at a man page solved the problem.

echo -ne "Content-type: text/plain\n\n"
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

This topic is closed to new replies.

Advertisement