Solved

checking $? value

Posted on 2007-03-21
2
157 Views
Last Modified: 2010-04-16
I have written a build script which creates a bin directory and compiles java code.
I call this build.sh in another script,dailybuild.sh ,I would like to test that the script ran correctly.
For this I used $?, but this value is turning out to be 1 instead of 0 even though the build.sh is correctly running.?Basically what I want to test is that the contents of build.sh ran properly-ie the code was compiled properly.
Is there a way to test that it ran correctly?
Thanks
0
Comment
Question by:ams7503
2 Comments
 
LVL 6

Accepted Solution

by:
FrivolousSam earned 50 total points
Comment Utility
$? returns the exit code of the command that was last run.

You need to check where build.sh is exiting that means the last command returned a nonzero exit code.

Start at the last instruction and do something like:
echo "command: xxxx | exit code: $?"
after it.

Keep adding echo commands until you realise which command is causing the problem.
0
 

Author Comment

by:ams7503
Comment Utility
Thank you for your help- by echoing stuff out I was able to figure out what was going wrong.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now