#!/bin/bash -x
ssh -T root@jumpbox ssh -T root@IP << EOF
YY=$(date +'%y')
echo $YY
EOF
OUTPUT:
Trying tunnel from jumpbox...
Pseudo-terminal will not be allocated because stdin is not a terminal.
-bash: line 6: YY: command not found
The variable I need to assign is more complex, it's not about year number as shown in my description.