From: Daniel Carrera Date: 2003-09-01T08:51:50+09:00 Subject: Re: `echo %!(*` Try this: - `vorbiscomment #{oldName}`.each_line do |line| + `vorbiscomment "#{oldName}"`.each_line do |line| The quotes should make the shell interpret the name literally, instead of seeing the brackets as a token. Cheers, Daniel. On Mon, Sep 01, 2003 at 08:46:33AM +0900, Tom Felker wrote: > On Mon, 01 Sep 2003 07:51:55 +0900, Daniel Carrera wrote: > > > I'm not sure I understand what you're asking about backtick > > interpolation. Can you give me a simple example of what you'd like the > > backtick to do so I understand beter? > > oldName = "02_Ship_At_Sea_(Instrumental).ogg" > tags = Hash.new > `vorbiscomment #{oldName}`.each_line do |line| > key, value = line.split("=", 2) > tags[key.downcase] = value > end > # ...use tags to formulate proper filename and rename > > # Errors: > sh: -c: line 1: syntax error near unexpected token `(' > sh: -c: line 1: `vorbiscomment 02_Ship_At_Sea_(Instrumental).ogg' > .... > > If you use system, you can pass the arguments in an array, and the shell > isn't used, so you can have arguments that the shell would barf on. > > system("echo !@#$%^&") == "" > system("echo", "!@#$%^&") == "!@#$%^&") > > I need a backtick method that works the same way. Having popen work > that way would be nice. As it is, I think it's only possible with > popen("-"), having the child exec in such a way as to not interpolate > the arguments, and reading from that. > > -- > Tom Felker, > - Stop fiddling with the volume knob. > > ruby -r complex -e 'c,m,w,h=Complex(-0.75,0.136),50,150,100;puts"P6\n#{w}\n#{h}\ > n255";(0...h).each{|j|(0...w).each{|i|n,z=0,Complex(.9*i/w,.9*j/h);while n<=m&&( > z-c).abs<=2;z=z*z+c;n+=1 end;print [10+n*15,0,rand*99].pack("C*")}}'|display > #by Michael Neumann AFAICT > -- Daniel Carrera, Math PhD student at UMD. PGP KeyID: 9AF77A88 .-"~~~"-. / O O \ ATTENTION ALL PASCAL USERS: : s : \ \___/ / To commemorate the anniversary of Blaise Pascal's `-.___.-' birth (today) all your programs will run at half speed.