Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Importance: Normal Subject: RE: Unix "script" utility continued... cygwin newbie need a porting expert's help. To: cygwin AT cygwin DOT com X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 Message-ID: From: "Perry Dykes" Date: Wed, 25 Jul 2001 07:41:07 -0500 X-MIMETrack: Serialize by Router on d27ml105/27/M/IBM(Release 5.0.7 |March 21, 2001) at 07/25/2001 07:41:09 AM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Tried you solution, but has one major drawback, return code setting. 1)Regarding why working script utility in unix. a) Currently using exec to a file, but all output is lost to screen and folks like to see output flow across xterms as they run (many scripts are 10-15 minutes in running time). b) Tried several options, but on non-cygwin, like the script utility best because it does not affect the script return code and does a nice job of putting content of a job execution (tracked with set -x, verbose but good for debugging). A unix without script is tough, as I like my bug submitters to issue a bash set -x, then script do things, and send me logs for debugging. 2) Your solution thoughts: a) Liked your suggestion, to be honest forgot about the subshell operation. b) The () > file.txt approach did not echo content to xterm during runs, so added the "|". Also went the {} scoping rather than () due to the limitations posed by the () approach. c) Tried, here is the script i was practicing with, but found a fundemental problem. #!/usr/bin/bash export retvalue=1 { set -x ls -al read text junk echo "$text" echo "$junk" echo "this is some test" grep -e "junk" junk # purposely generate bad rc to test bad rc values grep -CXT bla export retvalue=$? } 2>&1 | tee outfile.txt 2>&1 exit $retvalue However, the problem is that no matter what I do, the subshell boundry masks the return value. I have not yet found a trick around that problem unless I stuff into a file or something more persistent - any ideas? Regards, Perry -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/