How can I enter the following contents in a file:
Hi
abcd
I tried using echo "Hi\nabcd" >> ab.txt, but in the file it's written as is (the \n is included, instead of a newline)
|
How can I enter the following contents in a file:
I tried using |
||||
|
|
|
You need to tell
|
|||
|
|
|
The behavior of
¹ "It is not possible to use echo portably across all POSIX systems unless both -n (as the first argument) and escape sequences are omitted." |
|||||||||||||
|
|
You can also play games with quoting:
You type that in bash by hitting "Enter" after "Hi". Bash uses '>' as its continuation-of-command prompt for me. I could not escape an individual return with a backslash for some reason. |
|||
|
|
|
You can also just do |
|||
|
|