0

I want to run a script that enters a man page and leaves it. Something like (in pseudo-code)

$ man man
q

How can I do such a thing? Preferably the exit code will be 0.

More generally how do I do this for any interactive program?

  • 1
    Could you explain why you would ever need this? I mean, what's the point of entering an interactive environment from a non-interactive script? What are you trying to achieve? I ask because maybe there's a better way. – terdon Apr 12 at 10:50
  • Thanks, terdon. I perfectly understand this. I basically want to check if people in a certain environment enter certain interactive environments and when they do, I'd like to know that they did, after they left. – exiting Apr 12 at 10:53
  • 2
    But then how will having a script which can enter and leave an interactive environment help you monitor what other users are doing? You could probably have your script run man and exit it using something like expect, but how would that help you see what your users get up to? – terdon Apr 12 at 10:54
  • I was trying to give a simplified version of what's going on. I now see it was too simplified. Let me get back to you later. @terdon – exiting Apr 12 at 10:57

Your Answer

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

Browse other questions tagged or ask your own question.