[comp.unix.wizards] Help! How 2 get info from C to Unix

rjd@occrsh.ATT.COM.UUCP (12/06/87)

> >Is there a way that I can call my program within a Unix script and
> >set a variable in the Unix script to equal the filename the user
> >selected? ...
> 
> Have the program write the file name to stdout (e.g., via printf).
> Then use the backquote convention.  Assume your C program is called
> "prog" ...
> 
> 1) Bourne shell:
> 
>     VARIABLE=`prog`
> or
>     VARIABLE="`prog`"

   May not work as you have stated it.  One modification: make sure any output
intended to be seen by the user is sent to stderr, otherwise ALL output from
"prog" will be assigned to VARIABLE.  Make sure that the only output from
prog that goes to stdout is what is intended to be assigned to VARIABLE.
For that matter, should you need to, "prog" need not be a C program.  I have
written a number of shell scripts that do the same thing by redirecting all
prompt output to stderr (echo ..... >&2).

Randy