From: Hunt Jon Date: 2009-08-23T11:00:10+09:00 Subject: Checking if a specific Unix/Linux command exists I want to check if a command "port" is installed on Mac. Here is what I have now: File.open("test.txt", "w+") do |f| if system("port > /dev/null 2>&1") f.puts %x(port installed) else f.puts "No MacPorts command was found." end end I tried to check if the command "port" exists and if the command is found, it executes the command with the argument. Otherwise, it just prints the string "No MacPorts found"... When running the script, it stalls. Possibly because "port" command goes to interactive mode. I prevented the output by using "/dev/null", but it seems that the command is still running, but not output is shown. I was also playing with %x(). But I cannot find a solution. Jon