From: Nobuyoshi Nakada Date: 2008-07-13T09:41:25+09:00 Subject: Re: can ruby replace bash scripts for linux script Hi, At Sun, 13 Jul 2008 04:27:05 +0900, Xeno Campanoli wrote in [ruby-talk:307982]: > for d in $(ls $MYDIR/*) > do > echo "trace: $d" > done > > versus > > Dir["#{MYDIR}/*"].each do |d| > puts "trace: $d" > end > > So, given the difference isn't much, I'd assert the first one is a > little clearer. There are a lot of such examples. Note that you may get unexpected results if there are files contain space or shell meta-characters. Bourne familly shells automatically split strings into a list with $IFS. It's sometimes convenient but sometimes a pitfall. -- Nobu Nakada