12-03-2001
Question
I am not just checking for if the script ran or not. If I need to check the return code from the invoked program. Is this how I would do it ?
Have an exit code code specified for each action in the called program and then when I call it and check $? for the error code ?
Please correct me if I am wrong.
Thanks
Roshan
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a shell script that does NOT have the '#!' line at the top. It is written for ksh. The shell in my passwd entry is '/usr/bin/ksh' and my SHELL env variable is '/usr/bin/ksh'. Now, here's the issue. I invoke the script on Solaris with './myprog'. This works fine. I also run the same... (3 Replies)
Discussion started by: kowrip
3 Replies
2. Shell Programming and Scripting
hi,
i am one day old in shell scritpting. how to invoke one shell script from the other?
For eg.i have two shell scripts A.sh and B.sh. Inside A.sh i need to invoke B.sh and the return code of A.sh should be the value returned by B.sh.
it would be better if you provide any sample shell... (3 Replies)
Discussion started by: ajay xavier
3 Replies
3. Shell Programming and Scripting
I want to invoke shell script named bubesh.sh when submit button clicked on html/jsp page.I am using an apache server and the html & shell script are in the same working directory.Please help. (2 Replies)
Discussion started by: bubeshj
2 Replies
4. Shell Programming and Scripting
list me commands to invoke a shell script from php once the submit button is clicked in the php page. Requirement is Once a submit button is clicked it should run a script that displays the outcome of the script in a html/php. Please help.
Thanks in Advance,
BubeshJ (2 Replies)
Discussion started by: bubeshj
2 Replies
5. Shell Programming and Scripting
Hi everybody,
I have a script in which I'm invoking another script which runs in a subshell.
after the script is executed I want to return to the parent shell as some variables are set. However i'm unable to return to my original shell as the script which i'm calling inside is invoked in... (5 Replies)
Discussion started by: gurukottur
5 Replies
6. Shell Programming and Scripting
Hi,
I have an HTML form through which I get some text as input. i need to run a shell script say script.sh inside a perl-cgi script named main_cgi.sh on the form input.
I want to write the contents of the form in a file and then perform some command line operations like grep, cat on the text... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies
7. UNIX for Advanced & Expert Users
Hi All,
I am using the following command to invoke the shell script from a perl command.
perl -i.bak -pe'BEGIN { $cmd = "/opt/coreservices/tomcat-5.5.9/bin/digest.sh -a sha"; }
s/(password=")(*)/
$1.`$cmd $2|cut -d: -f2|tr -d "\n"`
/e
' $CATALINA_HOME/conf/tomcat-users.xml
I need... (1 Reply)
Discussion started by: nua7
1 Replies
8. Shell Programming and Scripting
Hello All,
I have a shell script A which is in one unix box. Also i have a script B in another unix box. Now i'm struggling to find a way to invoke A shell script from B shell script. Is it possible to do this in any way..Request you anybody please help me in this point.
Thanks in advance. (6 Replies)
Discussion started by: RSC1985
6 Replies
9. Shell Programming and Scripting
whats wrong here?!
________________
#!/bin/sh
# FILE: clean_dirs
# GOAL : To clean up directories used in Oracle processing
# LANGUAGE : shell script (sh)
# PARAMETERS : Input_File
# 11/07/02 acri - modified to cd into the directory so it will... (7 Replies)
Discussion started by: gillraj
7 Replies
10. Shell Programming and Scripting
Hi All,
I have a scenario :
1. A list of servers naming server21, server 22, server 23 etc. This list of servers is separate for my environments.
Env1 has 3 server
Env2 has 5 serves
Env3 has 10 servers
2. Each server accesses application through which I want to invoke some method. So... (7 Replies)
Discussion started by: ankur328
7 Replies
LEARN ABOUT FREEBSD
atf-check
ATF-CHECK(1) BSD General Commands Manual ATF-CHECK(1)
NAME
atf-check -- executes a command and analyzes its results
SYNOPSIS
atf-check [-s qual:value] [-o action:arg ...] [-e action:arg ...] [-x] command
DESCRIPTION
atf-check executes a given command and analyzes its results, including exit code, stdout and stderr.
Test cases must use atf-sh(3)'s atf_check builtin function instead of calling this utility directly.
In the first synopsis form, atf-check will execute the provided command and apply checks specified by arguments. By default it will act as
if it was run with -s exit:0 -o empty -e empty. Multiple checks for the same output channel are allowed and, if specified, their results
will be combined as a logical and (meaning that the output must match all the provided checks).
In the second synopsis form, atf-check will print information about all supported options and their purpose.
The following options are available:
-s qual:value Analyzes termination status. Must be one of:
exit:<value> checks that the program exited cleanly and that its exit status is equal to value. The exit code can be omit-
ted altogether, in which case any clean exit is accepted.
ignore ignores the exit check.
signal:<value> checks that the program exited due to a signal and that the signal that terminated it is value. The signal
can be specified both as a number or as a name, or it can also be omitted altogether, in which case any signal
is accepted.
Most of these checkers can be prefixed by the 'not-' string, which effectively reverses the check.
-o action:arg Analyzes standard output. Must be one of:
empty checks that stdout is empty
ignore ignores stdout
file:<path> compares stdout with given file
inline:<value> compares stdout with inline value
match:<regexp> looks for a regular expression in stdout
save:<path> saves stdout to given file
Most of these checkers can be prefixed by the 'not-' string, which effectively reverses the check.
-e action:arg Analyzes standard error (syntax identical to above)
-x Executes command as a shell command line, executing it with the system shell defined by ATF_SHELL. You should avoid using
this flag if at all possible to prevent shell quoting issues.
EXIT STATUS
atf-check exits 0 on success, and other (unspecified) value on failure.
ENVIRONMENT
ATF_SHELL Path to the system shell to be used when the -x is given to run commands.
EXAMPLES
The following are sample invocations from within a test case. Note that we use the atf_check function provided by atf-sh(3) instead of exe-
cuting atf-check directly:
# Exit code 0, nothing on stdout/stderr
atf_check 'true'
# Typical usage if failure is expected
atf_check -s not-exit:0 'false'
# Checking stdout/stderr
echo foobar >expout
atf_check -o file:expout -e inline:"xx yy
"
'echo foobar ; printf "xx yy
" >&2'
# Checking for a crash
atf_check -s signal:sigsegv my_program
# Combined checks
atf_check -o match:foo -o not-match:bar echo foo baz
SEE ALSO
atf-sh(1)
BSD
October 5, 2014 BSD