Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Use the -c option:

su - s3 -c "second command"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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