Article View: comp.unix.shell
Article #3982[tricky sh] how to log the stdout/stderr of a function ?
From: Gael Trinquart
Date: Fri, 16 Nov 2001 19:04
Date: Fri, 16 Nov 2001 19:04
17 lines
1567 bytes
1567 bytes
Hi, I try to log all the outputs of a sh function [ my_func | tee my_logfile ]. my_func is defined and called from my_script and modifies variables defined in my_script. The problem with 'my_func | tee my_logfile' is that it creates a sub-shell where my_func has its own copy of my_script's variables. When my_func returns, the subshell exits and everything is logged fine BUT the modified variables are, of course, not taken into account. How can I log everything from my_func AND be able to modify my_script's variables ? Gael.
Technical Details
Message-ID:
<50c0d466.0111161104.55629336@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,7f27c6718083ef6e,start X-Google-Attributes: gidfc89c,public X-Google-Thread: 1012a6,7f27c6718083ef6e,start X-Google-Attributes: gid1012a6,public X-Google-Thread: 110f2c,7f27c6718083ef6e,start X-Google-Attributes: gid110f2c,public X-Google-ArrivalTime: 2001-11-16 11:04:48 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: gaelt@yahoo.com (Gael Trinquart) Newsgroups: comp.unix.shell,comp.unix.programmer,fr.comp.os.unix Subject: [tricky sh] how to log the stdout/stderr of a function ? Date: 16 Nov 2001 11:04:47 -0800 Organization: http://groups.google.com/ Lines: 17 Message-ID: <50c0d466.0111161104.55629336@posting.google.com> NNTP-Posting-Host: 62.189.77.219 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1005937488 6958 127.0.0.1 (16 Nov 2001 19:04:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Nov 2001 19:04:48 GMT