log in as su from a script

Hi,

I am running a script where i need to run another command in a particular folder which I do not have access so I need
to login as su to that folder and run that script...what are the options I need so that I
can skip interactive mode ..here is what I tried..

#! /usr/bin/sh
./profile
su - u02 password # it does not take it this way...
cd /u02/inf
pmcmd -u $username -p $password -s $server.....
....

here my problems are
after executing the .profile it ececutes su and waits for password........

1) how should I enter the option su as i run the script from my ID specifying su password...
2) will the variables that are defined in my profile stay even though i do su and run command because
$username,$password,$server are in .profile.....

how should I use it...please help...

Please read our rules which state:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post where your goal is to get an answer more quickly.

I will close this duplicate thread.