Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!think!ames!fxgrp!ljz
From: ljz@fxgrp.UUCP (Lloyd Zusman, Master Byte Software)
Newsgroups: comp.unix.wizards,comp.unix.questions,comp.lang.c
Subject: Re: Help! How 2 get info from C to Unix script
Message-ID: <171@fxgrp.UUCP>
Date: Fri, 4-Dec-87 16:19:09 EST
Article-I.D.: fxgrp.171
Posted: Fri Dec  4 16:19:09 1987
Date-Received: Wed, 9-Dec-87 06:48:29 EST
References: <1569@ssc-vax.UUCP>
Reply-To: fxgrp!ljz@ames.arpa (Lloyd Zusman, Master Byte Software)
Followup-To: <1569@ssc-vax.UUCP> bact@ssc-vax.UUCP (Archie A. Auxter)
Organization: FX Development Group, Inc., Mountain View, CA
Lines: 49
Keywords: C, Unix script, need help
Xref: mnetor comp.unix.wizards:5822 comp.unix.questions:5199 comp.lang.c:5739

In article <1569@ssc-vax.UUCP> bact@ssc-vax.UUCP (Archie A. Auxter) writes:

> ...
>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`"


2) C Shell using a local variable:

    set VARIABLE = `prog`
or
    set VARIABLE = "`prog`"

3) C Shell using an environment variable:

    setenv VARIABLE `prog`
or
    setenv VARIABLE "`prog`"



    


-------------------------------------------------------------------------
 Lloyd Zusman
 Master Byte Software
 Los Gatos, California
 "We take things well in hand."        UUCP:   ...!ames!fxgrp!ljz

 NOTE:  It's difficult to reach this site.  If you've sent mail to me
	and not gotten a reply, it's probably because the net couldn't
        find this site and I never got your note.  Mailing to this site
        will yield best results if you explicitly enter a UUCP path name
        (as shown above) instead of counting on your news poster or on
        your "sendmail" to handle things properly.  Any help with net
        paths to 'ames' (the only feed to my site) would be greatly
        appreciated.  Sorry for the inconvenience.