handy for windows but *nix ppl would probably use sed.
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death Like a lamp standing in a strong breeze. --Nagarjuna
> Ruby is such a sweet language that you can achieve alot with little code
>
> I'd like to see what 'one-liners' others have come up with.
>
> here's one I find usefull.
>
> ruby -e 'puts ENV["path"].downcase.split(";").sort'
>
> handy for windows but *nix ppl would probably use sed.
Not necessarily, but we would use PATH and ":"
David
--
David A. Black
dblack@wobblini.net
···
On 8/8/05, David A. Black <dblack@wobblini.net> wrote:
btw - this is the first use i've ever found for using the %<space> trick...
-a
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death Like a lamp standing in a strong breeze. --Nagarjuna
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death Like a lamp standing in a strong breeze. --Nagarjuna
From: "David A. Black" <dblack@wobblini.net>
> Does this:
>
> ruby -e 'puts ENV["PATH"].downcase.split(/[:;]/).sort'
>
> not work on all platforms? Or are there quote/escaping issues?
DOS (cmd.exe) will need the double- and single-quotes swapped:
Unlike awk, mawk, and gawk, Ruby under DOS accepts single quotes as
argument wrappers. However, if the string contains |, <, or >, then
you had better use double quotes.
Follows version that makes PATH case-insensitive. Works even if you
have several environment variables that match /^path$/ (possible under
Linux et. al.) their content is printed one after another).
Josef 'Jupp' SCHUGT
--
Terrorism is the systematic use of violence and brutality as a means of
gaining some political end. So the "War on Terrorism" is a failure if
it increases violence and brutality and even may be terrorism by itself
if some well-known incidents turn out not to be singular ones.
Bill Kelly wrote:
> DOS (cmd.exe) will need the double- and single-quotes swapped:
>
> ruby -e "puts ENV['PATH'].downcase.split(/[:;]/).sort"
Did you try it without swapping the quotes?
Unlike awk, mawk, and gawk, Ruby under DOS accepts single quotes as
argument wrappers. However, if the string contains |, <, or >, then
you had better use double quotes.
Whoa... ! Thanks. Makes me wonder if that always been true,
even back when the standard Ruby distribution for windows was
cygwin based? Or maybe I got so accustomed to
perl -e 'print "huzzah\n"'
Can't find string terminator "'" anywhere before EOF at -e line 1.