Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Feb 2008 20:55:28 +0100
From:      Roger Olofsson <raggen@passagen.se>
To:        Martin McCormick <martin@dc.cis.okstate.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Setting Variables in expect Scripts From Shell Output
Message-ID:  <47C31D30.6000104@passagen.se>
In-Reply-To: <200802251620.m1PGKl4w069144@dc.cis.okstate.edu>
References:  <200802251620.m1PGKl4w069144@dc.cis.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help


Martin McCormick skrev:
> 	While running an expect script, is it possible to set an
> expect script variable to the string kept in a shell variable?
> 
> 	I can generate the shell variable just fine but when I
> try to export it to the expect script for later use with something like:
> 
> set LOGFILENAME [exec echo \$TMPFILE]
> 
> something happens without error, but a later attempt to see the
> contents of it such as
> 
> send_user "$LOGFILENAME\n"
> 
> proves that it never got set. It just echoes the literal string
> LOGFILENAME.
> 
> Thanks.
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 
> 

If you're not too worried about speed my old trick to circumvent this 
was to simply write the variable to a temporary file then read in that 
file for the send_user thing later on...Providing the send_user is a 
script, mind you.

Just my nickels worth...remember to delete the tempfile though.

/R





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C31D30.6000104>