bug-bash
[Top][All Lists]
Advanced

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

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


From: Jean-Jacques Brucker
Subject: why "shopt -p" sometime return non-zero ?
Date: Wed, 24 Sep 2025 14:10:48 +0200
User-agent: Evolution 3.56.1-1

  
Hello friends,

I met a strange behavior with "shopt -p", which could ruin my sleep .  
  
In a part of a script, i would like to use extglob,  
then I wrote:

```
# save extglob shopt  
extglob="$(shopt -p extglob)" 
# Make sure extglob is set  
shopt -s extglob
```
(and later: )
```
# make sure extglob is as we found it before.
$extglob

```

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

Why ?

NB: As I use to use "set -e", it is a little annoying, and I won't like to add 
a dirty "|| true" as a workaround.

NB2: Tested on 2 debian machines, bash versions : 5.2.37 and 5.2.15.

```
-- 
```
#### Jean-Jacques Brucker

Certificat : 
[udid4=sRyUhe...](http://keys.foopgp.org:11371/pks/lookup?op=vindex&search=0xFE1349E747CF1896)

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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