Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: updating shopt compat settings to include current version Date: Wed, 21 Oct 2015 09:21:25 -0400 Lines: 49 Approved: bug-bash@gnu.org Message-ID: References: <20151015173433.GS4446@vapier.lan> <561FF051.8000001@case.edu> <20151015192704.GU4446@vapier.lan> <56200730.2060900@case.edu> <20151015213025.GW4446@vapier.lan> <562119D1.5040606@case.edu> <20151020184923.GI3918@vapier.lan> Reply-To: chet.ramey@case.edu NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1445433698 9973 208.118.235.17 (21 Oct 2015 13:21:38 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <20151020184923.GI3918@vapier.lan> X-Junkmail-Status: score=10/60, host=mpv6.cwru.edu X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.105.36 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11732 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/20/15 2:49 PM, Mike Frysinger wrote: >>>> I mean, in theory, it's simple to do that: >>>> >>>> unset BASH_COMPAT >>>> shopt -u compat31 >>>> command shopt -s compat32 2>/dev/null >>> >>> ... but that doesn't work in bash-3.2: >>> $ bash-3.2 -c 'shopt -s compat32' >>> bash-3.2: line 0: shopt: compat32: invalid shell option name >> >> No, it really does. That's why I redirected the output to /dev/null. I f >> you run with `set -e' enabled, you can follow it with `|| :'. >> >> Running those commands leaves shell_compatibility_level == 32 on all >> existing versions of bash >= bash-3.2. The trick is that on bash-3.2, >> unsetting compat31 sets the shell compatibility level to 32, so the >> failed attempt to set compat32 doesn't make a difference. > > my point was to have a code snippet that works for any bash version and a > shifting base. we've established that you aren't interested in adding mo re > compat flags, and that BASH_COMPAT is not useful for error checking. fin e, > we'll just add some ad-hoc checks ourselves using the existing bash versi on > variables. that isn't supposed to sound petulant, just accepting of the > reality of the situation. I don't think you're petulant. I gave you the code snippet you wanted. You can use whatever you'd like. - -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEUEARECAAYFAlYnkUcACgkQu1hp8GTqdKvFyACXSeoqrLQ/vBFWEWRvTnMCNIcA IwCfT7JtZUOxc+y/PWCSa5rUMJzubg0= =W03D -----END PGP SIGNATURE-----