I'm trying to automate a Unix command script and pipe the output to mailx so I can know if I need to manually edit files before FTPing them. A lot of this is automated, but due to a bug I need to manually pause the automation process if a script detects certain data.
I'm trying to run the script display_orders. After you start the script, it asks for input and then returns output. I need to give the script a TargetSubID value and then redirect the output to mailx.
username@unix$ display_orders TargetSubID: BROKERA Size: Side: Symbol: There were 3 trades found!
The TargetSubID, Size, Side, and Symbol are prompts for input. You can either type a value you'd like to search for or hit enter to continue to the next prompt. At the last prompt the script takes all the input and does it's magic, and returns the values based on the input.
I've tried doing things like:
display_orders << EOD ? BROKERA ? ? ? ?EOD
But the script does runs and seems like there is an input parsing issue (which I don't expect you to troubleshoot). Looking at the code for display_orders it looks fairly standard Perl, chomping the input and parsing it.
I'd like to just get a command line solution for this so I can add it to my cron jobs (plus I've always been curious how to automate input based console applications).
I've tried googling but my google fu is weak on this topic apparently. I think I just want to redirect input to the console application but I think I'm fundamentally not understanding how the << operator works.
In the end I'd like a solution that might look similar to this (I realize this doesn't work but this may help someone understand what I'm trying to do):
display_orders << BROKERA | mailx -s 'Daily OATS Check' email@example.com