This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Unix "script" utility continued... cygwin newbie need a porting expert'shelp.



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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]