Skip to main content

Mutable Ideas

bash multi-line string

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

MSG='one
two
three
four'

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

ID=123

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

mysql -e "${SQL}"