This is what I am trying
script1
var=10
sh -x script2 "$var"
script2
su - someuser << EOF
1
cd dir
echo "This is : $1 Error" >> somefile
2
2
0
exit
EOF
Everything in script2 is executing. When I am checking the file "somefile" the output is
This is : Error
It is not showing the value of var