Unix Programming - Return Value of a Command

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2005 > Return Value of a Command





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Return Value of a Command
junky_fellow@yahoo.co.in

2005-02-15, 8:06 am

When a command is executed from the shell (ksh), its return value
may be obtained by command "echo $?". This return value is equal to the
error no (errno) if any of the system call in the executed command
fails.
The shell and the command executed are two different processes,
then how the return value (error) of the command is known to
shell.
Also, in most of the programs I have seen if any of the system call
fails the program exits with 1. So, during exit() also we are not
telling anyone about the errno.

Thanx in advance for any help ....

Gregory Toomey

2005-02-17, 2:47 am

junky_fellow@yahoo.co.in wrote:

> When a command is executed from the shell (ksh), its return value
> may be obtained by command "echo $?". This return value is equal to the
> error no (errno) if any of the system call in the executed command
> fails.
> The shell and the command executed are two different processes,
> then how the return value (error) of the command is known to
> shell.
> Also, in most of the programs I have seen if any of the system call
> fails the program exits with 1. So, during exit() also we are not
> telling anyone about the errno.
>
> Thanx in advance for any help ....


Is this a question or a political statement?

gtoomey
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com