Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11283
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Charles Daffern <seejay.11@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release) |
| Date | Sun, 2 Aug 2015 22:15:45 +0100 |
| Lines | 55 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.7768.1438550165.904.bug-bash@gnu.org> (permalink) |
| References | <55BE6FB8.4080200@tlinx.org> <55BE7DD6.3040509@tlinx.org> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AKU7iPxA12TwvhQnf0pVlVgtKgoBfvjLt" |
| X-Trace | usenet.stanford.edu 1438550166 13909 208.118.235.17 (2 Aug 2015 21:16:06 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-type; bh=9h7Ph/iXla+WLgsWoULPzgo9XqG67WEIpGQrpud8H/E=; b=u68hPk7rShYELP+5mD7qb6PMyB1Eyi1MPHmWkx3KxefCRwlFJQxN1PBbp+mSzCV6bB MLPbIqsOV2VQnrTcPFav1bx+azQaR3v8jxwaSFeF0VeFUQIKtfP4RHnxC2tDVIpmGDOs AD9YEaPnfYe3xjCKC4US394rkQKOQJgEU4yDR9RX28ZRYBnDjMwvprom91gClvIxdWvW E1PiQFc5VFPlbKpejbmZp+6wf600RgZx3HXbEpmFRKjbr/l6Rvph9tYFjFDSqXIH5ytn mBcgaog0Z+BV4KSk4BYaYNHE2A1353u+UlVfRnHMmvKMJxJVR6Vg1w2hTAcbGUejKWbH nZaw== |
| X-Received | by 10.180.8.68 with SMTP id p4mr27812852wia.27.1438550159674; Sun, 02 Aug 2015 14:15:59 -0700 (PDT) |
| Openpgp | id=AF6C170E59E8276568DD539A2B02A98D99BB3683; url=https://keybase.io/score_under |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
| In-Reply-To | <55BE7DD6.3040509@tlinx.org> |
| X-detected-operating-system | by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). |
| X-Received-From | 2a00:1450:400c:c05::22b |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:11283 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 02/08/15 21:30, Linda Walsh wrote:
> Am just looking for an efficient way to test for 0x0a
> as last char in a var, ... after another 20 minutes of
> trying things at random, found this:
>
> > printf "%d\n" "'${a:0-1:1}'"
> 10
>
> Oddly, the final single quote in the string seems unnecessary.
> But that (or into a var: printf -v var) both work...but I
> feel a bit contorted trying so many odd ways to get something
> that I thought would be simple, to work.
Most of the problems here are due to the use of command substitution (as
I mentioned in an earlier response).
The ways I would go about checking for a newline at the end of a string are:
[ "$var" != "${var%$'\n'}" ]
or
[[ $var = *$'\n' ]]
Back to gnu.bash.bug | Previous | Next | Find similar
Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release) Charles Daffern <seejay.11@gmail.com> - 2015-08-02 22:15 +0100
csiph-web