From: dagbrown@... (Dave Brown) Date: 2003-10-04T11:53:02+09:00 Subject: Re: backquotes, system, shell and ruby In article , John Carter wrote: : Somebody suggested I use zsh instead of bash for my commandline, so I : looked at it, looked at the syntax for tweaking the profile files, and : said... : "Yuck! Another badly designed syntax! Why can't I just use Ruby?" : : And that got me thinking. : : Consider backquotes. : : a = `wc *.c` : : What did that do? Same as open("|wc *.c"). : : It ran bash! : : Yuck! : : system( "tar -xvzf foo.tgz foo") : : What did that do? It ran shell! So, er... Give it a list instead! irb(main):012:0> system("echo $PPID") 16554 => true irb(main):013:0> system("echo","$PPID") $PPID => true The second version has not been touched by a shell of any kind. Cool, huh? : Why? Why does a scripting language like Ruby keep invoking an old and bad : scripting language call shell? : : Because... ....you keep telling it to! "Doctor, it hurts when I do this!" "Well, stop doing that then." --Dave -- "Kids have it easy today. All they have to listen to is stories about how back in the '70s we had to listen to stories about how bad it was back in the '30s." -- Keith Lynch