From: ruud grosmann Date: 2008-07-14T17:09:06+09:00 Subject: Re: can ruby replace bash scripts for linux script On 13/07/2008, ara.t.howard wrote: > > On Jul 12, 2008, at 1:27 PM, Xeno Campanoli wrote: > >> for d in $(ls $MYDIR/*) >> do >> echo "trace: $d" >> done >> >> versus >> >> Dir["#{MYDIR}/*"].each do |d| >> puts "trace: $d" >> end > > first one does not work, the second does. for d in $MYDIR/* do echo $d done This kind of file and directory processing can be very consise in a shell (bash, ksh or zsh or name it; this type of constructs can be used on the command line too) For short commands it can't be beaten by higher level scripts. But the point where it is smarter to use perl or ruby is quickly reached.... Ruud