MyTetra Share
Делитесь знаниями!
How to assign a heredoc value to a variable in Bash
Время создания: 21.08.2015 11:08
Раздел: root - Linux - Console - bash
Запись: Yurons/mytetra/master/base/144014453656is4125d5/text.html на raw.github.com

You can avoid a useless use of cat and handle mismatched quotes better with this:

$ read -r -d '' VAR <<'EOF'
abc'asdf"
$(dont-execute-this)
foo"bar"''
EOF

If you don't quote the variable when you echo it, newlines are lost. Quoting it preserves them:

$ echo "$VAR"

 
MyTetra Share v.0.59
Яндекс индекс цитирования