I'm confused. The return 1 statement can only be used in a function or a sourced shell script. This doesn't apply here?
Sorry I left out the bash header. I am using Bash.
I have several load.sh scripts, and want to call them all from one test.sh script.
Each load.sh script calls a C++ function that returns an error code (0 means EXIT_SUCCESS).
Is there a way to pass the error code from C++ function, to load.sh, to test.sh?
And then test.sh use the returned error code in a conditional statement?
Thanks.
tests.sh:
load.sh:
from command line:
I was expecting it to output "1".
I have two string returning function in ESQL/C
char *segment_name(lbuffer)
char *lbuffer;
{.....
and
char *get_bpdvalue(f_name)
char *f_name;
{......
both declared above main()
char *get_bpdvalue();
char *segment_name();
my problem is segment_name works on sprintf and strcpy... (5 Replies)
Hi all,
I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this:
but it keeps giving me wrong return:
Can someone help me out here, please?
Thanks (2 Replies)
hi
how can I return multiple values from a C function. I tried the following:
#include <stdio.h>
void foo(int id, char *first_name, char *last_name)
{
/*
this is just an example to illustrate my problem... real code makes
use of the "id" parameter.
*/
first_name = (char... (8 Replies)
Hello all,
I would like to know if it is possible to return a the result of a boolean expression from a function like this
function()
{
# some code
return ||
}
and what will be the return value ?
Thank you for help. (6 Replies)
Hi All
In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter.
Is there some built in command or way of... (3 Replies)
Hi searched hi and wide for this with no luck.
Maintaining a bash script that
#!/usr/bin/bash
#does some stuff like setting env etc.
f_do_dbwork
...
..
#Now I want to exit with the value of $err however $err is re-initialised to 0 on exiting the function
Always 0
....
... (3 Replies)
Hi All,
I am using malloc function for allocating dynamic memory.
When I am using below code on Linux server its working fine, but When I am trying the same code on HP UNIX server its returning NULL.
below is a fragment of code in which it is giving problem.
tmp = (format_tree... (4 Replies)
Heyas,
Since this question (similar) occur every now and then, and given the fact i was thinking about it just recently (1-2 weeks) anyway, i started to write something :p
The last point for motivation was... (17 Replies)
Hi All,
Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition.
#Body
function1()
{
if
then
echo "exist"
else
echo "not exist"
}
#if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
LEARN ABOUT DEBIAN
test::exit
Test::Exit(3pm) User Contributed Perl Documentation Test::Exit(3pm)NAME
Test::Exit - Test that some code calls exit() without terminating testing
VERSION
version 0.03
SYNOPSIS
use Test::More tests => 4;
use Test::Exit;
exits_ok { exit 1; } "exiting exits"
never_exits_ok { print "Hi!"; } "not exiting doesn't exit"
exits_zero { exit 0; } "exited with success"
exits_nonzero { exit 42; } "exited with failure"
DESCRIPTION
Test::Exit provides some simple tools for testing that code does or does not call "exit()", while stopping code that does exit at the point
of the "exit()". Currently it does so by means of exceptions, so it will not function properly if the code under test calls "exit()"
inside of an "eval" block or string.
The only criterion tested is that the supplied code does or does not call "exit()". If the code throws an exception, the exception will be
propagated and you will have to call it yourself. "die()"ing is not exiting for the purpose of these tests.
exits_ok
Tests that the supplied code calls "exit()" at some point.
exits_nonzero
Tests that the supplied code calls "exit()" with a nonzero value.
exits_zero
Tests that the supplied code calls "exit()" with a zero (successful) value.
never_exits_ok
Tests that the supplied code completes without calling "exit()".
AUTHOR
Andrew Rodland <andrew@hbslabs.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by HBS Labs, LLC..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.10.1 2009-12-04 Test::Exit(3pm)