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:24:37 -0600

>> But the line
>> extglob="$(shopt -p extglob)" )
>> returns 1.
>>
>> Why ?

>$ help shopt
>...
>    Exit Status:
>    Returns success if OPTNAME is enabled; fails if an invalid option is
>    given or OPTNAME is disabled.

So, really, all that's needed is:

shopt -q extglob || extoff=Y
shopt -s extglob
# Do stuff here
[ "$extoff" ] && shopt -u extglob

=================================================================================
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]