From: Marc Hoeppner Date: 2008-04-08T22:14:54+09:00 Subject: call console command and return as string...problem Hi, I am trying to use the following line of code in a rails application, but I dont think my problem has anything to do with rails, but with ruby, so this is why I post it here. To set the scene - I am programming an application for biological sequence analysis (among other things...). I want to pass the contents of an array (DNA sequences) to an external program. This program, however, needs a file as input and doesnt seem to take input from STDIN (its written in C so I have no clue how to mess with its code to change that..). So instead I write the sequences into a file and pass the name to the program. So far so good. But if I run it like this @result = %x{program-executable -o infile.txt} the variable @result is empty (should be a string, right?). If I call the exact same command from the command line, it prints the output to the screen, so I figured that it should go into the @result variable, no? Any suggestions on what I am doing wrong? Also, if by chance, anybody has an idea on how to pass the variable to the program instead of going via the route with a physical file, I'd be glad to hear it. Cheers, Marc -- Posted via http://www.ruby-forum.com/.