[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: errexit and local variable set by failing command
From: |
Krystian Wojtas |
Subject: |
Re: errexit and local variable set by failing command |
Date: |
Wed, 01 Apr 2020 17:21:30 +0000 |
Aha, already known. Thank you for link. I'll get familiar with other cases.
I just figured out that it works as expected if local variable is firstly
declared and then set.
Pozdrawiam,
Krystian Wojtas
Sent with ProtonMail Secure Email.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
środa, kwiecień 1, 2020 7:17 PM, Greg Wooledge <wooledg@eeg.ccf.org> napisał(a):
> On Wed, Apr 01, 2020 at 04:54:42PM +0000, Krystian Wojtas via Bug reports for
> the GNU Bourne Again SHell wrote:
>
> > Script has set errexit flag. It runs function. Function declares
> > local variable and set it to output of run subcommand. Subcommand fails.
> > Script does not care and continue execution.
> >
>
> https://mywiki.wooledge.org/BashPitfalls#pf27
script-local-variable-bug-workaround.sh
Description: application/shellscript