From: Josef 'Jupp' SCHUGT Date: 2003-12-02T07:19:09+09:00 Subject: Re: anything disappearing from Ruby for 2.0? Hi! * David Garamond; 2003-12-01, 12:43 UTC: > Josef 'Jupp' SCHUGT wrote: >> I cannot see anything that requires one-liners besides showing >> off. They are not even fun in most cases. > > I find the ability to write one-liners _amazingly_ useful. Perhaps > you don't use shell/command-line interface much. If propose one-lines you possibly did not yet discover the *true* strength of using a CLI. A few years ago I would have supported your statement. But then I started to use shell multiliners during interactive sessions. > But many, many Unix/Linux users do most of their stuffs in shell > daily. And using a combination of Unix commands sometimes are just > not powerful/easy/portable enough. I use Perl & Ruby one-liners > for all things, from renaming a bunch of files according to some > string/regex operation (e.g. changing all ".tar.gz" to ".tgz"), That can easily be done using the following (KSH, Bash should do as well) three-liner: for i in *.tar.gz; do mv $i ${i%.tar.gz}.tgz done One way of achieving the same in Ruby is the following five-liner: ruby < Btw, I even have a text file where I store hundreds of Perl & Ruby > one-liners which I can just copy paste to the shell window whenever > I needs them. It beats having hundreds of script files which I > don't know how to name properly. The same works for multiliners as well. I don't see why to make everything fit into one line if there is no necessity for it. Josef 'Jupp' Schugt