LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-06-2006, 06:04 AM   #1
zachos.v
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Rep: Reputation: 0
Unhappy 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
 
Old 10-06-2006, 07:04 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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.
 
Old 10-10-2006, 09:39 AM   #3
zachos.v
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Original Poster
Rep: Reputation: 0
you are right
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 ) from the script even if the cp was successful!
 
Old 10-10-2006, 09:51 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Let me explain a bit more.
Better post the script instead.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can a C function return value to Shell Script variable yarnar Programming 17 06-02-2010 05:54 PM
Return value to shell in script mwade Linux - Newbie 11 08-18-2006 09:49 AM
My shell return message always print chaos code backpacker Linux - Newbie 1 06-24-2005 07:05 AM
return value from shell script to c code? khucinx Programming 1 05-13-2004 03:43 PM
return key on shell script chupacabra Programming 2 10-22-2002 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration