coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using tee after if-fi construct clobbers variable


From: Steve Aberle
Subject: Re: using tee after if-fi construct clobbers variable
Date: Mon, 22 Jan 2018 09:47:00 -0800
User-agent: Mozilla Thunderbird on Debian GNU/Linux 9

Okay, thanks. At least I have the workaround to only use the pipes where variables are not being set.


Eric Blake wrote on 01/22/2018 09:37 AM:
On 01/22/2018 11:04 AM, Steve Aberle wrote:
Thanks for the quick response Eric.  In 30+ years of shell scripting,
this is the first time I've ever had a problem to report (and it took me
over 8 hours of cutting down a more extensive script to isolate what was
going on).  Can you suggest a different shell?

I'd prefer to answer the question on list:

https://rwmj.wordpress.com/2010/11/08/want-help-dont-email-me-directly/

It sounds like you're using bash?  That's a perfectly fine shell once
you know the limitations and use alternative constructs that don't use
pipelines.  Again,

http://mywiki.wooledge.org/BashFAQ/024  has more details about this
common shell programming pitfall.
Switching shells isn't magically going to find you a shell that does not
fork a subshell for pipelines (there are some shells that avoid the fork
for the right side of the pipe, and even new enough bash can be
configured to run in that mode; but ALL shells fork for the left side).
But switching away from bash is going to make you lose the bash
extensions that exist to conveniently avoid pipelines, such as <()
process redirection.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]