Skip to content

Instantly share code, notes, and snippets.

@mmaz
Forked from abn/heredoc-dockerfile.snip
Last active August 29, 2015 14:23
Show Gist options
  • Save mmaz/6adb07686cab4f03dc8d to your computer and use it in GitHub Desktop.
Save mmaz/6adb07686cab4f03dc8d to your computer and use it in GitHub Desktop.
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2\n'\
> /tmp/hello
## or you can use >>
RUN cat /tmp/hello
#echo
RUN echo -e '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
>> /tmp/hello
@mmaz
Copy link
Author

mmaz commented Jun 15, 2015

echo -e:

-e     enable interpretation of backslash escapes
-E     disable interpretation of backslash escapes (default)

But -e didn't work for me, so I went with printf. Also, I tacked on an extra trailing newline, in order to cat the file out without scribbling over the terminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment