Sponsored Content
Top Forums Shell Programming and Scripting bash: executing commands and reading exit vals Post 302080381 by aigles on Tuesday 18th of July 2006 05:56:04 AM
Old 07-18-2006
Code:
func1()
{
    .....do stuff
    #echo "$EXIT_CODE"
    return $EXIT_CODE
}

if func1 $arg1 $arg2
then
   # func1 : succes (exit status 0)
else
   # func1 : error
fi

func1 $arg1 $arg2
if [ $? -eq 0 ]
then
   # func1 : succes (exit status 0)
else
   # func1 : error
fi

Jean-Pierre.

Last edited by aigles; 07-18-2006 at 11:54 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

2. UNIX for Dummies Questions & Answers

nohup - sub job in script not executing until I exit

My job is launched using this command: I'm at home and having VPN drops so I used nohup and background. nohup perf_mon -c rating_4_multi,cfg & The main script is PID 26119, and the sub task under it is 26118 which is not running - just sits there. 26119 runs forever but nothing else runs. I... (2 Replies)
Discussion started by: ido1957
2 Replies

3. Shell Programming and Scripting

Executing multiple processes without waiting for their exit status.

Hello Friends, Hope you are doing well. I just need a help in executing multiple processes. I've written a shell script which calls another scritps. But the problem is there are too many processes to run, and each process takes about a min to finish its execution. So, I want to just... (3 Replies)
Discussion started by: singh.chandan18
3 Replies

4. Shell Programming and Scripting

OSX, bash, cat with <<MARKER executing commands

I have a script that writes another script with cat >/usr/local/bin/myscript.sh <<EOF #!/bin/sh VAR=`run a command here` EOF Problem is, after this is run, I get: $ cat /usr/local/bin/myscript.sh #!/bin/sh VAR=result of command How do I stop that from happening with Macs... (2 Replies)
Discussion started by: jnojr
2 Replies

5. UNIX for Dummies Questions & Answers

Execute shell script and if string found while executing then exit

Hi All, I have one shell script start.sh which executes another shell script test.sh something like below :test.sh -param1 -param2 In the test.sh there is one command for removing file:rm file1.bak I want whenever I execute start.sh, it will execute test.sh and if it finds string rm... (7 Replies)
Discussion started by: ORAI
7 Replies

6. Shell Programming and Scripting

Executing 'exit' command from shell script

Hi, I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script. My intension is to execute... (4 Replies)
Discussion started by: Mahesh Desai
4 Replies

7. Programming

Fork and Execvp Not Executing Bash Commands From C correctly.

I had been looking at page 75 of this online book: http://richard.esplins.org/static/downloads/linux_book.pdf I've used the system function in C to call bash commands before, but wanted to learn this way too. The solution in the book worked perfectly. However, I tried changing the simple "ls -l... (3 Replies)
Discussion started by: Azrael
3 Replies

8. AIX

C Exit Not Executing

Greetings all, I am using an enterprise utility for document archiving. This program calls a custom C exit to do data manipulation before loading data into the archive. When the program is called via an automation script (Ran as ROOT), program successfully executes the C exit, and gives me an... (3 Replies)
Discussion started by: jeffs42885
3 Replies

9. Shell Programming and Scripting

Executing bash file with sudo for the second time, leads to permission denied, for some commands

I have a script that checks if the script has been ran with sudo. If the script is not ran as sudo, the current script is being executed with exec sudo bash. You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies
BootStrap(3pm)						User Contributed Perl Documentation					    BootStrap(3pm)

NAME
Net::DNS::SEC::Tools::BootStrap - Optional loading of Perl modules SYNOPSIS
use Net::DNS::SEC::Tools::BootStrap; dnssec_tools_load_mods( PerlModule => 'Additional help/error text' ); DESCRIPTION
The DNSSEC-Tools package requires a number of Perl modules that are only needed by some of the tools. This module helps determine at run- time, rather than at installation time, if the right tools are available on the system. If any module fails to load, dnssec_tools_load_mods() will display an error message and calls exit(). The error message describes how to install a module via CPAN. The arguments to dnssec_tools_load_mods() are given in pairs. Each pair is a module to try to load (and import) and a supplemental error message. If the module fails to load, the supplemental error message will be displayed along with the installation-via-CPAN message. If the error message consists of the string "noerror", then no error message will be displayed before the function exits. CAVEATS
The module will try to import any exported subroutines from the module into the main namespace. This means that the BootStrap.pm module is likely to not be useful for importing symbols into other modules. Work-arounds for this are: - import the symbols by hand dnssec_tools_load_mods( PerlModule => 'Additional help/error text' ); import PerlModule qw(func1 func2); func1(arg1, arg2); - call the fully qualified function name dnssec_tools_load_mods( PerlModule => 'Additional help/error text' ); PerlModule::func1(arg1, arg2); COPYRIGHT
Copyright 2006-2012 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. AUTHOR
Wes Hardaker <hardaker@users.sourceforge.net> SEE ALSO
http://www.dnssec-tools.org/ perl v5.14.2 2012-01-27 BootStrap(3pm)
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy