Why does this work (as root):
$su - aba ~> echo $JAVA_HOME
And not this shell script (also run as root):
#!/bin/bash su - aba << EOF echo $JAVA_HOME > tmp EOF
$more tmp $
Question: How can I make this work? Or better: My goal is to execute some commands as another user and also use this enviroment of this user and maybe even change his enviroment (only temporary).
In the meantime I succeeded with
runuser - aba -c 'echo JAVA_HOME', altough it's not in all aspects what wished for, because I still can only transfer one command-line.