[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another "set" option?
From: |
Pierre Gaston |
Subject: |
Re: Another "set" option? |
Date: |
Thu, 11 Jul 2013 13:03:31 +0300 |
On Wed, Jul 10, 2013 at 8:35 PM, Geir Hauge <geir.hauge@gmail.com> wrote:
> 2013/7/10 Bruce Korb <bruce.korb@gmail.com>
>
>> This seems like a lot of obtuse bother:
>>
>> xtrace_setting=$(
>> re=$'\nxtrace[ \t]+on'
>> [[ $(set -o) =~ $re ]] && echo ' -x' || echo ' +x')
>>
>> if there were only some magic like ${BASH_SETTING_XTRACE} or
>> xtrace_setting=$(set -q xtrace) or something. Could we get
>> something fairly straight forward for querying set/shopt state?
>> Thank you for considering. Regards, Bruce
>>
>
> shopt -qo xtrace && xtrace=1
>
For the single letter options you can also use the standard: case $- in *x*) ...