rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: gatech!skeeve!arnold@harvard.harvard.edu (Arnold D. Robbins)
To: Chris Siebenmann <cks@hawkwind.utcs.toronto.edu>
Cc: rc@archone.tamu.edu
Subject: Re: today's rc programming challenge
Date: Fri, 17 Apr 1992 07:34:13 -0500	[thread overview]
Message-ID: <9204170734.AA11086@skeeve.ATL.GA.US> (raw)

>  Given: a string in a variable.
>  Wanted: the same string but without the newline on the end
> 
>  Challenge: how, in the (possible) presence of any character except binary
> 0 in the string, do to this? Bonus points awarded for the shortest solution,
> the most efficient solution, and one that can be stuck in a function.


	x='foo
	'
	x=`{tr -d '
	' <<< $x}

	fn stripnl { ret=() {
		ret=`{tr -d '
	' <<< $1
		return ret
	}}

Arnold


             reply	other threads:[~1992-04-17 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-04-17 12:34 Arnold D. Robbins [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-04-17 13:23 rsalz
1992-04-16 22:11 Chris Siebenmann
1992-04-17 11:07 ` Robert Earl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9204170734.AA11086@skeeve.ATL.GA.US \
    --to=gatech!skeeve!arnold@harvard.harvard.edu \
    --cc=cks@hawkwind.utcs.toronto.edu \
    --cc=rc@archone.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).