su user -c command -args doesn't accept arguments
Posted on 2006-11-01
I'm new with shell scripting so I may be missing something easy. I'm writing a shell script which I want to su to a different user in my case the root user. The problem is that when I do that it takes control away from the script. Basically all I need to do is run one command as the root user so I decided I could write
su root -c ./mycommand args
which doesn't take control away from the script however mycommand now doesn't get the args I pass it. What can I do to fix this???