Mail Archives: cygwin/2001/07/25/08:42:42
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/
- Raw text -