su in a shell script

Hi,
how to switch to another user in a shell script ?
something like this :
su - newuser
How to give the password ?
In two cases :
1-I want to give the password as a parameter (argument) of my script.
2-I want to hard code password in my script file.

many thanks before.

maybe you can do it like this
e.g
su - <INFILE
newuser \
password(${passwd})
INFILE

thank you.
My script :

passwd=${1}
su - <INFILE
newuser \
password(${passwd})
INFILE

And errors :

No such file or directory
myscript.sh[2]: INFILE: cannot open
myscript.sh[3]: syntax error at line 4 : `(' unexpected

You should rather use sudo for what you try to accomplish.
As root you would edit the sudoers file via visudo
and define a rule set that would allow a less privileged user
to run commands or scripts as another user or even root.
sudo offers fine grained control to share privileges and will log their execution.

unfortunately I can not login as root.

su -c "comadn"
for example
su -c 'visudo'

Then I see no chance how you may get away from being prompted for a password
when you do run a command as another user via su other_user -c some_cmd.
For security reasons the su command is meant to prompt for a password when executed
by a non-root user.
This is similar to the passwd command that prompts you for the current password
and even twice for the new one.
Ask the sysadmin of this system to have a sudo rule added that would meet your requirements.

it's seam that you can't run the su command
with a shell script . Because standard in must
be a tty