From: Fernando Cacciola Date: 2007-10-24T06:07:25+09:00 Subject: Re: bash to ruby Marc Heiler wrote: > "So, is there any guideline on how to port bash scripts to ruby?" > > Well the basic functionality of mkdir or cd is all there in std ruby. > > Do you have a specific problem? 卒 > Not yet, because I haven't started :) But I'll follow your advice and post on demand... As I said I don't really know ruby. I read quite a lot already but haven't got my hands dirty yet with some real stuff, so I'm using this as an excuse so do something real. Last time I found motivation in programming something arbitrary just to learn a new language was about 20 years ago, but this would be inmediately useful, so should be fun. I'll try to identify patterns and post here my proposed counterparts. For instance, I gather so far that FileUtils would provide most file/dir handling. My probably next step is to find out how to port typical grep/sed commands (their typical usage, not all of it) >Just post away here, I am sure people > like to squish away with the ugliness of shell scripts (did you guys > know that libtool has > ~7500 lines of shell code? ... it has some genious macros... > > #ifndef DIR_SEPARATOR_2 > # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) > > > if eval test -z \"\${$var+set}\"; then > relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; > export $var; }; }; $relink_command" > > > must be fun to maintain this ;> ) > Fortuntely the scripts I need to port are not that overly-clever, so I don't unticipate much trouble. Best Fernandi