how to pass a variable that include a string with line break to git message

43 Views Asked by At

I have

A=123
B="abc${A}efg\n\
ijk"

if I echo $B it returns:

abc123efg
ijk

I want to pass B as the git commit message like this:

git commit -m $B

However, it does not create multiple lines and does not treat \n as a line break.

what should I do?


update:

this worked

git commit -m "$(echo -e "$B")"
0

There are 0 best solutions below