3 ms·
I believe the pure bash way of assigning a multi line string to a variable, without dealing with quoting, might be as follows: IFS='' read -r -d '' HEAD_TE
by rascul 5y ago
I believe the pure bash way of assigning a multi line string to a variable, without dealing with quoting, might be as follows:
IFS='' read -r -d '' HEAD_TEMPLATE <<'EOF'
<title>Sherver example</title>
<meta name="description" content="Sherver example">
EOF
https://stackoverflow.com/questions/1167746/how-to-assign-a-heredoc-value-to-a-variable-in-bash/1655389#1655389 https://stackoverflow.com/questions/1167746/how-to-assign-a-...
- throwaway984393 5y agoI mean, if it's got no single quotes: HEAD_TEMPLATE=' <title>Sherver example</title> <meta name="description" content="Sherver example"> '
- rascul 5y agoYes this is indeed simpler, however I noticed in some of the code single quotes were also used [0] so I wanted to use an example that would work for that. [0] https://github.com/remileduc/sherver/blob/master/scripts/index.sh#L75 https://github.com/remileduc/sherver/blob/master/scripts/ind...