Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Chet Ramey Newsgroups: gnu.bash.bug Subject: Re: assoc_expand_once issues Date: Sun, 23 Sep 2018 15:09:33 -0400 Organization: ITS, Case Western Reserve University Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: 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 1537729784 20702 208.118.235.17 (23 Sep 2018 19:09:44 GMT) X-Complaints-To: action@cs.stanford.edu Cc: chet.ramey@case.edu To: Grisha Levit , bug-bash Envelope-to: bug-bash@gnu.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=TkdM3Q1tPtimA3m+NZed4UWsbZsPa1K8mXwDYR5MdK8=; b=BbzEToj7f/zYRlysFKp/QS4yHN6WK7RIwWO+LzWh8hIT4To3p9rl00eTxprYoQBfxl SAuiq+Kx9wSULxqyHN36g9E4TfG1nQeuMZKLutjsVXYbY45+c03X0zy86M+K5a/+P/nr 4YvOvD5GqotxpGFfTultGZOCaLDbR7HvUI7N1A072sOgW/3gYEHxDN6DZQ/XJ14UxPrP KhyUERpE0aUtYbXRmC16EkSegjQtggqgVTTkisVsURx/4ujgJDF2dTZv7XI/whb9psPM AQ7Fdprnr2fA+cgddFPxCZcfxnnjpOq6ZcORQx294dk5OyWS67S22X8VPRylqjxma1Yg UgTw== X-Gm-Message-State: ABuFfohHJfNK23VlPRHGaEQqVmyLPEnLPyxqQH+PsAyceVfpTy3JvRgZ YGPEBg6fzKIPG6t4FQa3rjP/rFlzp8jMY1p/7S3351YScF9SG3OvLjzmicuSSBkUj0SGgJXYDll xlH3fzoK37UY= X-Received: by 2002:a24:a388:: with SMTP id p130-v6mr5426660ite.146.1537729775934; Sun, 23 Sep 2018 12:09:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV61GaSkgd498bp58a08zacKI2bKjfubawc4iGLJ82J10euowso/G7ujvuioehwp9cK/mn1dwUg== X-Received: by 2002:a24:a388:: with SMTP id p130-v6mr5426648ite.146.1537729775675; Sun, 23 Sep 2018 12:09:35 -0700 (PDT) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 In-Reply-To: Content-Language: en-US X-Junkmail-Status: score=7/90, host=mpv2-2015.case.edu X-Junkmail-PrAS-Raw: score=7/90, refid=2.7.2:2018.9.23.180616:17:7.944, ip=, rules=__YOUTUBE_RCVD, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __PHISH_SPEAR_SUBJ_ALERT, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1200_1299, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 129.22.103.227 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 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:14649 On 9/20/18 6:37 PM, Grisha Levit wrote: > I was testing out this new feature and I can't figure out how to handle > certain characters in subscripts when the option is on. Without the > option, > it is possible to escape the `$' in the subscript to achieve the desired > result but obviously that does not work if the option *is* on -- is there a > different workaround to use or is this a bug with assoc_expand_once? Well, I don't think it's a bug, per se. There are three cases here: 1. Expansion performed both during word expansion of the assignment statement and during evaluation of the subscript. 2. Expansion performed during word expansion of the assignment statement. 3. Expansion performed during evaluation of the subscript. Case 1 is what bash has always done. Case 2 is what assoc_expand_once provides. Case 3 is what you want, and what you're simulating by quoting the expansion in case 1. I think there might be a way to take advantage of the information provided by case 2 to do what you want with these (usually not allowed) subscripts. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/