Hi People,
I want to incorporate an if statement in my code to check if the program is running in interactive or non-interactive mode, such that if it is running unattended I can feed it some data for the prompts or simply skip any prompts. I would prefer not to use a check for a TTY because I may at some stage in the future drop this program onto a pseudo terminal and this will then show an active TTY. Any ideas on the best way forward with this....I'm guessing that some of you are already using your own solution to this?
My definition for this I think would be a test to see if stdout is being directed to something other than /dev/tty. Would this be a good test??
ART
I want to incorporate an if statement in my code to check if the program is running in interactive or non-interactive mode, such that if it is running unattended I can feed it some data for the prompts or simply skip any prompts. I would prefer not to use a check for a TTY because I may at some stage in the future drop this program onto a pseudo terminal and this will then show an active TTY. Any ideas on the best way forward with this....I'm guessing that some of you are already using your own solution to this?
My definition for this I think would be a test to see if stdout is being directed to something other than /dev/tty. Would this be a good test??
ART