473,608 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

build script return throws an error when build fails

365 Contributor
This is my build script, I calls this script from main build script, in case of SUCCESS, everything is ok, but in failure, I do "return 1", so that main build can cheque "$?" and based on that it prints success or not, but here "return 1", throwa an error "./build: line 17: return: can only `return' from a function or sourced script", any idea?. I did issue command "cat build" below. any iddue with "return 1"?.

$ cat build

make clean
make
echo "gcc -shared -Wl,-soname,libRecei ver.so.1 -o libReceiver.so. 1.0 -L/opt/lib PC_Receiver.o"
gcc -shared -Wl,-soname,libRecei ver.so.1 -o libReceiver.so. 1.0 PC_Receiver.o
status=$?
if [ $status = 0 ] ; then
echo "mv libReceiver.so. 1.0 /opt/lib"
mv libReceiver.so. 1.0 /opt/lib
echo "ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so"
ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so
echo "ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so. 1"
ln -sf /opt/lib/libReceiver.so. 1.0 /opt/lib/libReceiver.so. 1
echo SUCCESS creating shared lib
else
echo ERROR creating shared lib
return 1
fi
Dec 21 '09 #1
3 1982
RRick
463 Recognized Expert Contributor
Replace the return in line 17 with an exit command (i.e. exit 1). Typically, return is only used inside a subroutine. Outside of subroutines, use exit.
Dec 21 '09 #2
tvnaidu
365 Contributor
Thanks. But here I want to return 1 for ERROR case, since I am calling this build script from main build script, where I will check return value "$?", incase if it is not zero, then I want to display error and comeout from main routine. anyother way "$?" should show 1 ?.

$ echo $?
0

$ ./build
echo ERROR creating shared lib

$ echo $?
0
Dec 21 '09 #3
tvnaidu
365 Contributor
Thanks Rick. It works, I was confused earlier, sorry.
Dec 22 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2821
by: Paul Winkler | last post by:
This is driving me up the wall... any help would be MUCH appreciated. I have a module that I've whittled down into a 65-line script in an attempt to isolate the cause of the problem. (Real domain names have been removed in everything below.) SYNOPSIS: I have 2 target servers, at https://A.com and https://B.com. I have 2 clients, wget and my python script.
7
3870
by: Randell D. | last post by:
Folks, I've found a nice menu piece of javascript that works fine when the code is included entirely inside the html page. However, when I place the javascript code outside, in its own ".js" type file, it doesn't execute. IE6 reports an error "Object expected" line 30, char 1, code 0. This is the BODY tag which I've pasted below (with carriage returns to make it easier to read). I cannot understand as to how this line could be...
2
3595
by: hubert_s | last post by:
I have DB2 8.1 FP7, when I try to build a Java stored procedure it fails during a call to DB2_REPLACE_JAR. Even the build folder "bld1096553970703" is not there - it has a different name, regards, Hubert DB2ADMIN.PROCEDURE2 - Build started. DROP SPECIFIC PROCEDURE DB2ADMIN.SQL030805133228210 DB2ADMIN.PROCEDURE2 - Drop stored procedure completed.
0
1249
by: Tim Kiely | last post by:
I have a managed C++ class that exposes a COM object to ASP.NET. This COM object creates several other COM objects internally. A VS.NET 2002 build of the dll works fine on .NET 1.0 and 1.1. A VS.NET 2003 build, however, fails when the COM object calls CoCreateInstance. This happens only if the .NET type is used by two web applications on the same server. The first web app to create the .NET type always succeeds and the second web app...
17
7903
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php" requires user input to run; this causes the TCL script calling the PHP script to hose up and die. Is there a way I can do this so that the TCL script can call the PHP
24
2185
by: Earl | last post by:
I have all of my data operations in a separate library, so I'm looking for what might be termed "best practices" on a return type from those classes. For example, let's say I send an update from the UI layer to a method in a library class that calls the stored procedure. Best to return a boolean indicating success/failure, return a string with the exception message, or just return the entire exception?
7
4343
by: plumb and tree | last post by:
I've been trying for days to build 64 bit python with Solaris 10 + Sun Studio 12. Can anyone helpl please. This is how I tried to do build: # ./configure --prefix=/opt/python2.4 --without-gcc --enable-shared checking MACHDEP... sunos5 checking EXTRAPLATDIR...
4
6182
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages generated are written to a log file. A project team working in the same company as me here would like to use this loading utility. They write UI applications for Windows using Java. They were able to launch the Python script from within Java by...
1
47435
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8059
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8000
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6815
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1328
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.