From: Marc Heiler Date: 2008-07-13T06:13:51+09:00 Subject: Re: can ruby replace bash scripts for linux script > versus > > Dir["#{MYDIR}/*"].each do |d| > puts "trace: $d" > end Why use 3 lines? Dir["#{MYDIR}/*"].each { |d| p 'trace: '+d } Also the two versions are not the same IMO because ruby applies .each on an array. I didn't know you meant an iteration, I really thought you referred to a loop {} :) Maybe we should compare longer versions to get a clear picture too including methods/functions Also bash-scripts are a DSL for bash so if they are allowed to use a DSL, ruby should be too :) > So, given the difference isn't much, I'd assert the first one is a > little clearer. There are a lot of such examples. I don't really see that bash is clearer here. In a typical shell scripts I see a lot of conditionals applied if [ "$os" != "SunOS" ] then zeige="echo -e" else zeige="echo" fi And to be honest I see no point in being more readable. > I think another aspect of where I'm at is that everybody knows Bash, and > I did allude to that before. People new to Linux are not. I also challenge the notion that everybody knows bash == everybody likes to write bash, or even knows bash/shell scripts. > you try to provide the best environment for them to do so. Sure. I give them ruby :) Linux distributions love shell scripts. It is one reason why they fail to grow - these shell scripts are hardly maintained by other people. They are ugly, sometimes buggy, provide no real additional value ... and what is one supposed to use them for on windows anyway? Enter Ruby. > I can certainly see it being reasonable to do practically everything in > Ruby, however, and I wouldn't mind doing that if the work environment > made it a reasonable way to go. Well, I don't say to abandon bash scripts. :) They have many use cases, one that comes to my mind if ruby is not available or broken (i manage to break everything.... ) I just think that people need to stop relying so much on shell scripts as they did the last 20 years. Shell scripts didnt revolutionize the world, and they won't. They can provide task, but so can ruby. And I think it is simply better to look for new ways to solve problems rather than sticking to concepts which won't change much anymore. Anyway, hopefully we convinced Greg Hauptmann to stick to the solution he prefers, so at least ruby will get a decent chance ;-) -- Posted via http://www.ruby-forum.com/.