Sponsored Content
Top Forums Shell Programming and Scripting How to capture status code and echo a message Post 302190530 by Nanu_Manju on Wednesday 30th of April 2008 12:47:42 AM
Old 04-30-2008
How to capture status code and echo a message

I guess you call your function like this:

result=`Your_function`

# From your question it is a character 'o', if so then use the below condition
if [ "$result" = "o" ]
Just in case you meant the number 0 (zero) then use the below condition
if [ $result -eq 0 ]
then
echo "....."
else
echo "....."
fi

BTW, can you tell me how to post a new question in this forum. I appear too dumb as I spent already 15 mins finding the place for submitting questions.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sh Prgram to capture Log message.

Hi All, I have a log file which consists of log messages as follows -> GLOBALCALLID_CLUSTERID_B NEXT * , O(") CHARACTER JOINONBEHALFOF NEXT * , O(") CHARACTER Record 1: Rejected - Error on table IFA_MMV_CDR, column CDRRECORDTYPE.... (1 Reply)
Discussion started by: rahulrathod
1 Replies

2. Shell Programming and Scripting

Append Status to echo'd line after process completes

Hello All, I'm very new to scripting and I'm writing a very simple script to restart a couple processes because I'm getting to lazy to cd between directories. This is pretty much my first script and I just want to add a little cosmetics to it. Here's what I have: #!/bin/ksh echo... (5 Replies)
Discussion started by: Setan
5 Replies

3. Shell Programming and Scripting

How to capture actual error message when a command fails to execute

I want to capture actual error message in case the commands I use in my shell script fails. For eg: ls -l abc.txt 2>>errorlog.txt In this case I understand the error message is written to the errorlog.txt and I assume its bacause the return code from the command ls -l abc might return 2 if... (3 Replies)
Discussion started by: prathima
3 Replies

4. Shell Programming and Scripting

How do I capture multiple lines of the status output of a command?

I need to know what the upload speed of an Internet connection. I thought the easiest way to do this would be to transfer a file via FTP to my server using the command: sh-3.2$ ftp -u ftp://username:password@computerdomain/directory/ file_to_be_uploaded Note: My environment allows me to issue... (2 Replies)
Discussion started by: zzz1528
2 Replies

5. Shell Programming and Scripting

[Perl] Capture system call error message.

Hi, I googled a bit, but could not find the answer to my problem. But I am sure it is a common issue. I have this code: #!/bin/perl -w #-d use strict; sub remsh_test() { my $host = $_; printf "\n----\n\n"; printf "remsh to $host with system call\n"; my $result = system... (3 Replies)
Discussion started by: ejdv
3 Replies

6. Shell Programming and Scripting

How to echo message when file is empty.

If a file is empty then it must print the message "no data found" eg: if then echo "no data found" your help is really appreciated. (3 Replies)
Discussion started by: javeedkaleem
3 Replies

7. Solaris

zpool status -v erros message

# zpool status -v pool: pool1 state: ONLINE status: One or more devices has experienced an error resulting in data corruption. Applications may be affected. action: Restore the file in question if possible. Otherwise restore the entire pool from backup. see:... (0 Replies)
Discussion started by: beginner
0 Replies

8. Shell Programming and Scripting

Script to retry FTP commands if unsuccessful and capture the failure status code.

I am using the below code to ftp file onto another server FTP_LOG_FILE=${CURR_PRG_NAME}- ${FTP_FILE}-`date +%Y%m%d%H%M%S`.log ftp -ivn ${FTP_HOST} ${FTP_PORT} << ENDFTP >> ${EDI_LOG_DIR}/${FTP_LOG_FILE} 2>&1 user ${FTP_USER} ${FTP_PSWD} lcd... (2 Replies)
Discussion started by: akashdeepak
2 Replies

9. Shell Programming and Scripting

Find a string in all files and echo a message

Hi. I m trying to figure out how to do this. I have a directory full of files (100 files) and I want to be able to search for a string called "end" at the end of the files (last line or last 5 lines) and echo each file to say "incomplete" if not found. This is what I have so far. ---... (4 Replies)
Discussion started by: jasonhawaii
4 Replies

10. Shell Programming and Scripting

UNIX Sqlplus - Capture the sql statement about to run and execution status

Greetings Experts, I am on AIX using ksh. Created a unix script which generates the CREATE OR REPLACE VIEW ... and GRANT .. statements, which are placed in a single .txt file. Now I need to execute the contents in the file (there are around 300 view creation and grant statements) in Oracle and... (4 Replies)
Discussion started by: chill3chee
4 Replies
ODBC_NEXT_RESULT(3)							 1						       ODBC_NEXT_RESULT(3)

odbc_next_result - Checks if multiple results are available

SYNOPSIS
bool odbc_next_result (resource $result_id) DESCRIPTION
Checks if there are more result sets available as well as allowing access to the next result set via odbc_fetch_array(3), odbc_fetch_row(3), odbc_result(3), etc. PARAMETERS
o $result_id - The result identifier. RETURN VALUES
Returns TRUE if there are more result sets, FALSE otherwise. EXAMPLES
Example #1 odbc_next_result(3) <?php $r_Connection = odbc_connect($dsn, $username, $password); $s_SQL = <<<END_SQL SELECT 'A' SELECT 'B' SELECT 'C' END_SQL; $r_Results = odbc_exec($r_Connection, $s_SQL); $a_Row1 = odbc_fetch_array($r_Results); $a_Row2 = odbc_fetch_array($r_Results); echo "Dump first result set"; var_dump($a_Row1, $a_Row2); echo "Get second results set "; var_dump(odbc_next_result($r_Results)); $a_Row1 = odbc_fetch_array($r_Results); $a_Row2 = odbc_fetch_array($r_Results); echo "Dump second result set "; var_dump($a_Row1, $a_Row2); echo "Get third results set "; var_dump(odbc_next_result($r_Results)); $a_Row1 = odbc_fetch_array($r_Results); $a_Row2 = odbc_fetch_array($r_Results); echo "Dump third result set "; var_dump($a_Row1, $a_Row2); echo "Try for a fourth result set "; var_dump(odbc_next_result($r_Results)); ?> The above example will output: Dump first result set array(1) { ["A"]=> string(1) "A" } bool(false) Get second results set bool(true) Dump second result set array(1) { ["B"]=> string(1) "B" } bool(false) Get third results set bool(true) Dump third result set array(1) { ["C"]=> string(1) "C" } bool(false) Try for a fourth result set bool(false) PHP Documentation Group ODBC_NEXT_RESULT(3)
All times are GMT -4. The time now is 12:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy