Mutable Ideas

Notes and ideas about Java, Scala, Big Data, NoSQL, Quality and Software Deploy

Bash Multi Line String

Quick reminder on how to use bash with multi-line string.

1
2
3
4
MSG='one
two
three
four'

I prefer this one, which allows me to use replace variables, ex:

1
2
3
4
5
6
7
8
9
ID=123

SQL=$( cat <<EOF
SELECT *
FROM clients
WHERE id = ${ID};
)

mysql -e "${SQL}"