I have some commands to be run after switching to a different user. I need to do this in a build xml file.
Following is what I have done -
<exec command="sudo su auto_deploy << EOF
echo 'Logged in user'
whoami
EOF" dir="${dir.scratchpad}" />
I have used XML escaping, i.e. <
for <
.
However, I am getting the following error -
sh: warning: here-document at line 0 delimited by end-of-file (wanted `EOF')
Related question - here-document gives 'unexpected end of file' error
Update
Note - I have not put any space after the starting EOF and before the ending EOF.
Update 1
Added bounty. Expecting an elaborate answer because I am unable to make much sense from the comments so far. Pardon my lack of knowledge.
Update 2
Just in case it was not clear, I am working on Phing, and the XML that I mentioned above is from the build xml file that Phing allows a user to write, to do deployment related stuff.
Update 3
As mentioned in the question referenced by @tripleee, I tried with this -
<exec command="sudo su auto_deploy << EOF${line.separator}echo 'Logged in user'${line.separator}whoami${line.separator}EOF" dir="${dir.scratchpad}" />
but it still throws the same error. Not sure what am I missing.