Here document

24年 10月 21日 Monday
64 words
1 minutes

if you are not familiar with sed, then you can use here document as alternative to help you write some text without open a text editor like vim, nano, etc.

bash
tee /path/to/dir/filename.txt << "EOF"
hemlo
EOF

you can use cat, but with tee, you have an advantage of saving a file as root using sudo.

bash
cat >/path/to/dir/filename.txt << "EOF"
hemlo
EOF

read more about shell redirection on askubuntu

Title:Here document

Author:ReYuki

Link:https://www.reyuki.site/posts/here-doc [copy]

Last updated:


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. You are free to share and adapt it, as long as you give appropriate credit, don’t use it for commercial purposes, and distribute your contributions under the same license. Provided under license CC BY-NC-SA 4.0