From: Benjamin Sommerfeld Date: 2002-07-27T03:19:13+09:00 Subject: Some basic Ruby questions Hi! I am writing a gallery maker (HTML) in ruby and could need some help.. I already know how to write to files. What I don't know is following: How can i execute some native commands in Ruby? (For example ls | grep "jpg" > test.txt) What I am planning to do is executing this linux command, so that all image files names get stored in a local file on the HD. And after that i want to read the filenames in my ruby application one by one, cause each file has an own line in this output file. So, it should look like this: def pictureMethod executeNativeCommand("ls | grep \"jpg\" > pictures.txt") pictureFile = File.open("pictures.txt","r") while(pictureFile.hasMoreLines) array.attach(pictureFile.actualLine) pictureFile.goOneLineDown end end I don't know the Ruby syntax that's why I wrote it in kind of "spoken code":-) Hope someone can help me out, Thanks in advance, Benjamin __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com