[ale] Perplexed by bash

Mike Murphy mike at tyderia.net
Tue May 3 17:22:24 EDT 2005


because RC only exists in the scope of the function, not in the scope of 
the enclosing script.

On 05/03/2005 06:15 PM, John Wells wrote:
> Can anyone tell me why the while loop in the below code affects the
> setting of the variable RC?  I'm at a loss.  Remove the while loop, and it
> works just fine...
> --
> #!/bin/bash
> function getRC
> {
>   RC="123"
> }
> 
> getRC \
> | while read line
> do
>   echo "456"
> done
> 
> echo "RC: $RC"
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

-- 

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Murphy
781 Inman Mews Drive Atlanta GA 30307
Landline: 404-653-1070
Mobile: 404-545-6234
Email: mike at tyderia.net
AIM: mmichael453
JDAM: 33:45:14.0584N  84:21:43.038W
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



More information about the Ale mailing list