bug-bash
[Top][All Lists]
Advanced

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

Re: IGNOREEOF and POSIXLY_CORRECT don't ignore invisible vars


From: Linda Walsh
Subject: Re: IGNOREEOF and POSIXLY_CORRECT don't ignore invisible vars
Date: Sat, 18 Jun 2016 16:59:21 -0700
User-agent: Thunderbird







Grisha Levit wrote:
The manual references these values being set, not just declared, so maybe should check for invisible_p?
---
Why?  I.e. what were you wanting to happen?

Noticeable for example because this works:

$ set +o posix; f() { local POSIXLY_CORRECT=; shopt -p -o posix; }; f; shopt -p -o posix
set -o posix
set +o posix
---
Yeah, you've set P_C to a null string.

But the opposite does not:

$ set -o posix; f() { local POSIXLY_CORRECT; shopt -p -o posix; }; f; shopt -p -o posix
set -o posix
set -o posix
---
The "opposite"?  You aren't really showing the opposite.  I.e.
wouldn't the opposite be (alias used for printing P_C & output of shopt)

alias shopos='printf "PC=%s; " $(if [[ -v POSIXLY_CORRECT ]]; then
printf "  set"; else printf "unset"; fi) ;shopt -p -o posix'

set -o posix; f() { local POSIXLY_CORRECT; unset POSIXLY_CORRECT;
printf " in f: "; shopos; }; printf "bfore f: "; shopos; f ; printf "after f: "; shopos
bfore f: PC=set; set -o posix
  in f: PC=unset; set -o posix
after f: PC=set; set -o posix

(and your first example:)

set +o posix; f() { local POSIXLY_CORRECT=; printf " in f: ";
shopos; }; printf "bfore f: "; shopos; f ; printf "after f: "; shopos
bfore f: PC=unset; set +o posix
  in f: PC=set; set -o posix
after f: PC=unset; set +o posix





reply via email to

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