I have the following commands that I want to have them all in one shell file:

su – s3
lizinfo.sh –b

when the first linex executes, it prompts and the command prompt become like as below:

-bash-3.1$ (here I cant type second command >> lizinfo.sh –b)

I want to have my shell file run all of these command at once. But when I run my shell file it only runs the first line and for does not run the second line, and waits until I enter it manually.

Would you help me please ?


Use the -c option:

su - s3 -c "second command"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.