Troubleshooting the 'system' call


#1

I was tyring to do a system call using sudo, like this:

system(“sudo /some/dir/somewhere/rubyprog.rb”,“opt1”, “opt2”)

but it kept giving me the wrong answer…always false. After some
head knocking, I realized that this is more appropriate:

system(“sudo”,"/some/dir/somewhere/rubyprog.rb",“opt1”, “opt2”)

because the COMMAND is ‘sudo’ and the ruby program becomes the
argument to sudo.

I realize that the docs say this fairly explicitly, but sheesh! :slight_smile:

Mike B.