From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from harvard.harvard.edu ([128.103.1.1]) by archone.tamu.edu with SMTP id <45321>; Fri, 17 Apr 1992 09:04:31 -0500 Received: by harvard.harvard.edu (5.54/a0.25) (for rc@archone.tamu.edu) id AA17332; Fri, 17 Apr 92 09:04:17 EST Received: from gatech.UUCP (uucp.gatech.edu) by gatech.edu (4.1/Gatech-9.1) id AA28315 for archone.tamu.edu!rc; Fri, 17 Apr 92 09:55:48 EDT Received: from skeeve.UUCP by gatech.UUCP (4.1/SMI-4.1) id AA20850; Fri, 17 Apr 92 09:03:31 EDT Received: by skeeve.ATL.GA.US (smail2.5) id AA11086; 17 Apr 92 07:34:15 EST (Fri) From: gatech!skeeve!arnold@harvard.harvard.edu (Arnold D. Robbins) Date: Fri, 17 Apr 1992 07:34:13 -0500 X-Mailer: Mail User's Shell (6.5.6 6/30/89) To: Chris Siebenmann Subject: Re: today's rc programming challenge Cc: rc@archone.tamu.edu Message-Id: <9204170734.AA11086@skeeve.ATL.GA.US> > 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