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.

These days many programs like mongodb, docker etc, have there own shell i.e., if you type docker -i it opens an interactive shell (similarly with mongo and other programs).

Is there a way to automate input to these shells via Uunix shell scripts? Or any other way a Unix shell could communicate with the shells of these programs?

share|improve this question
    
docker doesn't really have it's own shell. It just executes bash inside of the container. For mongodb, use the CLI client or a library. If you have something where all other options are exhausted, as a last resort you can use expect. –  jordanm May 10 at 2:11
    
Yepp docker doesnt have its open its own shell but that of its OS in its container.. I am having a look at expect but isn't there any other way like pipe or something ? –  Mebin May 10 at 2:19

1 Answer 1

While I am not in a position to try it the following should allow the redirection you require

$ docker -i < $(ls -lah)
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.