multi line string in bash

Multiline strings can be assigned in bash using one of these two examples.


$ String='foo1
foo2
foobar2'

STRING=$( cat <<EOF
foo1
foo2
foobar2
EOF
)

Comments

Anonymous said…
Thanks, syntax lookup was way easier than 'man bash'!

Popular posts from this blog

Vim vi how to reload a file your editing