How to check for an error if executing a shell command e.g

Hi,
I’m writing a little script to install some drivers but I wanna react in
this script if any step fails. So e.g. I’m doing this:
system(‘dpkg -i xorg-driver-fglrx fglrx-kernel-source’)
How can I check if this was succesful or if there was any error?

Alle venerdì 24 agosto 2007, kazaam ha scritto:

Hi,
I’m writing a little script to install some drivers but I wanna react in
this script if any step fails. So e.g. I’m doing this: system(‘dpkg -i
xorg-driver-fglrx fglrx-kernel-source’)
How can I check if this was succesful or if there was any error?

I think you should check the return value of system. It will return true
if
the command was run successfully and false otherwise.

Stefano

lol thanks this really works :smiley:

On Sat, 25 Aug 2007 03:11:20 +0900

kazaam wrote:

system(‘dpkg -i xorg-driver-fglrx fglrx-kernel-source’)
How can I check if this was succesful or if there was any error?

system returns true or false depending on whether or not the command
exited
successfully. You can also look at the exit status via the global var $?
HTH

On Fri, 2007-08-24 at 20:07 +0200, Sebastian H. wrote:

kazaam wrote:

system(‘dpkg -i xorg-driver-fglrx fglrx-kernel-source’)
How can I check if this was succesful or if there was any error?

system returns true or false depending on whether or not the command exited
successfully. You can also look at the exit status via the global var $?
HTH

popen4

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs