LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   To get state of a flag in set -o.. (https://www.linuxquestions.org/questions/programming-9/to-get-state-of-a-flag-in-set-o-4175726848/)

zeroone 07-11-2023 03:36 PM

To get state of a flag in set -o..
 
How do we get state of a flag in set -o ... that has no direct alias
set [-+] , e.g.

set -o posix
or
set -o vi
?

not, e.g. set -o errexit , as it can be retrieved by

$ echo $-

then it'll be determined if letter e exists at the output string. Please help sincerely.

thinknix 07-11-2023 03:40 PM

In bash you can 'echo $SHELLOPTS' or 'set -o' to see what is currently set (the latter is more portable).


All times are GMT -5. The time now is 10:31 PM.