Q:

New line in git hook

I have a git hook which calls a php file. The php file will produce an output (after running some Unit Tests). Te hook file is a sh file. The output from php file is echoed to the terminal, but \n is stripped, and everything is on a single line. Any ideas what I have to do to have new lines?
Thanks

A:

You can try and, in your sh script,

assign the output of the php script to a variable avar;
echo that variable with:
echo -e "${avar}"

That should keep the newlines, as mentioned in "echo multiple lines into a file".
The same link mentions printf as well.
printf '%s\n' "${avar}"

