"Tom Phoenix" <[EMAIL PROTECTED]> writes: > On Jan 18, 2008 7:00 AM, <[EMAIL PROTECTED]> wrote: > >> I just want to find out whether command("mk_view $view_name ETC") is >> properly running or not. > > I think you're looking for the program's exit status. Traditionally on > Unix and many similar systems, the exit status is an integer, with 0 > meaning "normal exit" and anything else meaning that something went > wrong. That's the value that's used by programs that run other > programs (such as the 'make' system utility) and need to know when a > step has failed. In Perl, you can access the exit status with the $? > variable after running a command via system or backticks. Beware: If > your command is run by the shell, you'll get the shell's exit status, > which may not be the exit status you were looking for. > > system $command; > if ($?) { > print "Oops, the command failed.\n"
Sorry to butt in here with a novice question but this issue is something I've recently been trying to use in some scripting. I thought this might be one way to get at the exit status of system, maybe its not such a good way? if((system( "$somecmd $cmdflgs"))== 0){ print "Yippie <$somecmd $cmdflgs> completed successfully\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/