bug-bash
[Top][All Lists]
Advanced

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

Re: why "shopt -p" sometime return non-zero ?


From: Stan Marsh
Subject: Re: why "shopt -p" sometime return non-zero ?
Date: Wed, 24 Sep 2025 07:52:29 -0600

>shopt -p extglob >/dev/null; s_extglob=$?
>shopt -s extglob

>( do processing )

>((s_extglob==1)) && shopt -u extglob



>I must think before posting. This still doesn't get over the fact
>that you've 'set -e'

Right - that's exactly the point.  Since OP is running "set -e", he
should use a construct like:

    shopt -q extglob || echo "It was unset!"

>not recommended.

Not recommended by a certain poster on this list, but other than that,
perfectly OK.  I use "trap ERR" instead, which I consider to be the
current/modern version of "set -e".

=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.

When responding to my posts, please try to refrain from giving bureaucratic 
answers.
If you have nothing useful to say, then just click Next and go on.



reply via email to

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