'make' escape characters inside quotes

Asked by Maike geng

I'm getting different results for escape characters in ubuntu's make when they are inside quotes.
Is that suppose to happen?

as example a command in makefile like:
    echo "line1\nline2"

gives output:
echo "line1\nline2"
line1
line2

Running that same output command in shell (bash):
<prompt:>echo "line1\nline2"
line1\nline2

I'm in 10.04 Lucid Lynx

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu make Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

Shell and Make don't use the same rules for enclosing character string. You will have to read manual. Be careful, escapes characters can be " or ', with different behaviors.

Revision history for this message
David Mawdsley (dm-madmod) said :
#2

Try visiting the man page for echo and note the discussion of -e:

man echo

Then try: echo -e "line 1\nline 2"

Can you help with this problem?

Provide an answer of your own, or ask Maike geng for more information if necessary.

To post a message you must log in.