From: "Swatosh, Joe R NWP" Date: 2001-01-06T10:14:27+09:00 Subject: [ruby-talk:8714] RE: Trouble with %x{} containing quotation marks >-----Original Message----- >From: Robert Gustavsson [mailto:robertg@swipnet.se] > >Joe R Swatosh wrote: > >>irb(main):002:0> %x{cmd /c "cd && dir *.txt"} > > Syntax error: Unterminated quoted string > > "" > > irb(main):003:0> %x{cmd /c \"cd && dir *.txt\"} > > Syntax error: Unterminated quoted string > > "" > >I got the following to parse and run: >irb(main):018:0> %x{ "command.com /c \"date\"" } > >But the return was >"" >vital statistics: >Windows 98 2nd ed. (Yes, I use NT which is superior to 98 at work, I left it downloading RedHat 7.0 though :-) > > D:\Code>ruby --version > > ruby 1.6.1 (2000-10-05) [i386-cygwin] >Same as me. > > What obvious thing am I overlooking? > Why isn't the output from the date command returned? >/rob You may have to hit an additional return, as date expects input unless you use the /t switch. You're probably not seeing the output because of buffering. Good idea to just enclose a single command in quotes, it makes things simpler. I can get the output from the date command when not using quotation marks, but when I do... irb(main):006:0> puts %x{ cmd /c date/t } Fri 01/05/2001 nil irb(main):007:0> puts %x{ "cmd /c date/t" } Syntax error: Unterminated quoted string nil irb(main):008:0> Please help, Joe Swatosh