RE: Korn shell function paramter passing

From: <Joel.Patterson_at_crowley.com>
Date: Thu, 25 Jun 2009 08:29:07 -0400
Message-ID: <0684DA55864E404F8AD2E2EBDFD557DA02F23447_at_JAXMSG01.crowley.com>



Thanks  

I was calling main  

main | tee -a ${LOGFILE}  

Removing tee solved the mystery.  

Now I have another problem...because this will undoubtedly have the same behavior if I tee of runsomething.  

The implication at first glance appears that all my print statements will each have to tee at least to the point of returning SUBJECT to the outermost shell (as the easiest and most forthcoming solution). I need SUBJECT to pass to function cleanup.  

I probably need a different way of looking at my architecture, (which this was), the architecture of dynamically generated filenames and simultaneously seeing output to screen, and calling the script from cron.  

The exec>&3 approach I suppose is another, but I haven't settled on anything yet I'm really happy with.      

Joel Patterson
Database Administrator
904 727-2546


From: Niall Litchfield [mailto:niall.litchfield_at_gmail.com] Sent: Thursday, June 25, 2009 8:15 AM
To: Patterson, Joel
Cc: oracle-l_at_freelists.org
Subject: Re: Korn shell function paramter passing  

other reasons, less common  

On Thu, Jun 25, 2009 at 1:11 PM, <Joel.Patterson_at_crowley.com> wrote:

No.  

Joel Patterson
Database Administrator
904 727-2546


From: Niall Litchfield [mailto:niall.litchfield_at_gmail.com] Sent: Thursday, June 25, 2009 8:07 AM
To: Patterson, Joel
Cc: oracle-l_at_freelists.org
Subject: Re: Korn shell function paramter passing  

are you using typeset to define local variables by any chance?  

Niall

On Thu, Jun 25, 2009 at 1:00 PM, <Joel.Patterson_at_crowley.com> wrote:

Joel Patterson
Database Administrator
904 727-2546

This one I'm spending to much time on.

I have a korn shell script.

#!/usr/bin/ksh
Do some initialization commands
Call a function startlogfile
Call function 'main'

    main calls function runsomething

        Runsomething initializes and returns "${SUBJECT}"     main can print ${SUBJECT}
    main returns ${SUBJECT} (or "${SUBJECT}", or ASUBJECT=${SUBJECT}

                             successfully ${ASUBJECT}, or "${ASUBJECT}"
outer most shell cannot print $SUBJECT

what's going on?

Thanks,

--
http://www.freelists.org/webpage/oracle-l






-- 
Niall Litchfield
Oracle DBA
http://www.orawin.info <http://www.orawin.info/> 






-- 
Niall Litchfield
Oracle DBA
http://www.orawin.info


--
http://www.freelists.org/webpage/oracle-l
Received on Thu Jun 25 2009 - 07:29:07 CDT

Original text of this message