rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* today's rc programming challenge
@ 1992-04-16 22:11 Chris Siebenmann
  1992-04-17 11:07 ` Robert Earl
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Siebenmann @ 1992-04-16 22:11 UTC (permalink / raw)
  To: rc

 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.

	- cks


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: today's rc programming challenge
@ 1992-04-17 12:34 Arnold D. Robbins
  0 siblings, 0 replies; 4+ messages in thread
From: Arnold D. Robbins @ 1992-04-17 12:34 UTC (permalink / raw)
  To: Chris Siebenmann; +Cc: rc

>  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


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: today's rc programming challenge
@ 1992-04-17 13:23 rsalz
  0 siblings, 0 replies; 4+ messages in thread
From: rsalz @ 1992-04-17 13:23 UTC (permalink / raw)
  To: chupchup, cks; +Cc: rc

I tried your function and got my trailing ` missing.

What's wrong with builtin echo -n ?


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1992-04-17 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-04-16 22:11 today's rc programming challenge Chris Siebenmann
1992-04-17 11:07 ` Robert Earl
1992-04-17 12:34 Arnold D. Robbins
1992-04-17 13:23 rsalz

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).