Output to Terminal in Batch Mode UNIX

D.Cook

Member
Is it possible to output to the terminal in batch mode on UNIX/Linux?
The obvious thing to try was this:
Code:
output to terminal.
message "Hello World".
Result: ** There is no terminal. (120)
In Linux the error is given, but on Windows it happily greets the world.

Also tried the following:
Code:
if opsys eq "UNIX" then
   output to /dev/stdout.
message "Hello World".
Result: ** Unable to open file: /dev/stdout. Errno=13. (98)

The reason I want to do this is to start a program from the command-line and have it output some text, without displaying the character client. If there's a better way please let me know!
 
I've done this a few times. The best solution I found was to create a shell script and create an Environment Variable, say MESSAGEFILE, and set it to be the filename/path of a file:

Code:
MESSAGEFILE=$HOME/somefile.txt

In the progress program, output any messages you want to display to the file
Code:
IF OS-GETENV ("MESSAGEFILE") <> ? THEN OUTPUT TO OS-GETENV ("MESSAGEFILE").

After you have run the progress session cat the output file
Code:
cat $MESSAGEFILE
rm $MESSAGEFILE
 
Thanks for the suggestion, but I found a simpler way! All I did was run the 'echo' command from within Progress and it seems to work well. And if output is redirected to file it works as expected.

So my platform independent solution is:

Code:
   if opsys eq "UNIX" and session:batch then 
      unix value("echo " + msg).
   else
      message msg view-as alert-box information.
 
Back
Top