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?

  • 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 '15 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 '15 at 2:19

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

$ docker -i < $(ls -lah)

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.