Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #2986
| From | Roy Zuo <roylzuo@gmail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: chomp behaviour |
| Date | 2011-04-15 21:19 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <20110416021847.GA17374@bender> (permalink) |
| References | <fd6f7d3388641b7b1873dbce2346c695@ruby-forum.com> |
``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)____
(__) )\
||--|| *
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
chomp behaviour Steel Steel <angel_steel@ymail.com> - 2011-04-15 21:08 -0500 Re: chomp behaviour James <oscartheduck@gmail.com> - 2011-04-15 21:15 -0500 Re: chomp behaviour Roy Zuo <roylzuo@gmail.com> - 2011-04-15 21:19 -0500 Re: chomp behaviour Peter Zotov <whitequark@whitequark.org> - 2011-04-15 21:21 -0500 Re: chomp behaviour Mike Stok <mike@stok.ca> - 2011-04-15 21:23 -0500
csiph-web