my scripts rely heavily on external programs and scripts. I need to be sure that a program I need to call exists. Manually, I'd check this using 'which' in the commandline.
Is there an equivalent to File.exists?
for things in $PATH
?
(yes I guess I could parse %x[which scriptINeedToRun]
but that's not super elegant.
Thanks! yannick
UPDATE: Here's the solution I retained:
def command?(command)
system("which #{ command} > /dev/null 2>&1")
end