1

export variable not working after su

view story
linux-howto

http://www.unix.com – I have a requirement to chaneg user inside a shell script and execute group of commands. I have done it many times earlier but never came across the issue with exporting variables. Strangely if a var is exported afetr su, it is not working where as if it is doen outside su, it work. ANother issue ,i noticed was with variable in for loop. Also i didnt have these problems with many other commands inside su Code: #!/bin/sh #ident  "@(#)Test script" #set -x id var0=123 su - user1<<EOF id var1='123' export var2=345 echo "var0 is $var0" echo "var (HowTos)