Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail From: Roy Zuo Newsgroups: comp.lang.ruby Subject: Re: chomp behaviour Date: Fri, 15 Apr 2011 21:19:38 -0500 Organization: Service de news de lacave.net Lines: 36 Message-ID: <20110416021847.GA17374@bender> References: NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=utf-8 X-Trace: talisker.lacave.net 1302920585 85144 65.111.164.187 (16 Apr 2011 02:23:05 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Sat, 16 Apr 2011 02:23:05 +0000 (UTC) In-Reply-To: X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381679 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <20110416021847.GA17374@bender> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:2986 ``echo "abc"`` outputs "abc\n", try this instead echo -n abc | ruby -e "puts gets.chomp 'c'" Roy On Sat, Apr 16, 2011 at 11:08:10AM +0900, Steel Steel wrote: > Using 1.9.1 > I noticed something with chomp > > $ echo "abc" | ruby -e 'puts gets.chomp("c")' > abc > > $ irb > irb(main):001:0> "abc".chomp("c") > => "ab" > > It doesn't work on the command line, or am i doing it wrong.? > comments? > > -- > Posted via http://www.ruby-forum.com/. > -- ___________________________________________________________________ / She's the kind of girl who climbed the ladder of success wrong by \ | wrong. | | | \ -- Mae West / ------------------------------------------------------------------- \ ,__, \ (oo)____ (__) )\ ||--|| *