LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Return code of a shell script (https://www.linuxquestions.org/questions/linux-software-2/return-code-of-a-shell-script-489957/)

zachos.v 10-06-2006 06:04 AM

Return code of a shell script
 
when I run a shell script I always get as return code -1. (Even if the script run successful.)

I test it with one line script just
cp $1 $2

I am using kernel 2.6.9-11.ELsmp (RED Had).
Any Ideas

Thanks

jlliagre 10-06-2006 07:04 AM

Quote:

Originally Posted by zachos.v
when I run a shell script I always get as return code -1.

Unlikely ...
Quote:

(Even if the script run successful.)
Even more unlikely, can you post the commands your run to execute the script and show its return value ?
There must be something wrong, as a shell script return value is between 0 and 255.

zachos.v 10-10-2006 09:39 AM

:scratch: you are right :o
Let me explain a bit more...
The script is copy a file from one location to another and then A program is processing the file. What I want is to check if the copy was successful or not.
To do that I check the return code of the script. If is 0 then the cp was successful if is any other value I return error.
this was running successful for RED HAD advance server 2.1. If I run that application to RED HAD advance server 4.1 I receive the value 1 (not -1 :o) from the script even if the cp was successful!

unSpawn 10-10-2006 09:51 AM

Let me explain a bit more.
Better post the script instead.


All times are GMT -5. The time now is 03:31 AM.