shell function help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell function help
# 1  
Old 11-15-2007
shell function help

SUN os KSH

ERROR_CHK () {

ERR_DATA="$ABC"
if `echo "$ABC" | egrep 'PLS|ERROR|ORA'` ; then
echo "Failed: Can't execute procedure ${PRG_NAME} ERROR found "
return 1
else
echo "Info : ${PRG_NAME} done"
fi

}

my function fails iwth
below message

"ERROR: not found"
I think i need to change
if `echo "$ABC" | egrep 'PLS|ERROR|ORA'` some whare

any help please

Last edited by Amresh Dubey; 11-15-2007 at 04:31 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

How to dynamically name as function in shell?

Hi all, Does anyone know if it possible to append a parameter to a function name? Something like the following: function tnsrec_${SERVICE_NAME} { code.. } Any ideas? (6 Replies)
Discussion started by: jonnyd
6 Replies

3. Shell Programming and Scripting

How to call a function in Shell..?

#!/bin/bash FUN_ECHO(){ echo $1 } FUN_ECHO "hi how are you ?" This code will work fine. BUT is it possible to make the following to work ? FUN_ECHO "hi how are you ?" FUN_ECHO(){ echo $1 } I know that the code will be executed line by line. But i have a number of... (5 Replies)
Discussion started by: linuxadmin
5 Replies

4. Shell Programming and Scripting

function from shell input

Hi all i have the command called printer which needs a usernmae for example i would run the commnad printer <username> how can i write i quick script in perl that if the username is ab then write "denined" and if it is anything else it will work thanks Adam (1 Reply)
Discussion started by: ab52
1 Replies

5. Red Hat

how to call a particular function from one shell another shell script

please help me in this script shell script :1 *********** >cat file1.sh #!/bin/bash echo "this is first file" function var() { a=10 b=11 } function var_1() { c=12 d=13 (2 Replies)
Discussion started by: ponmuthu
2 Replies

6. Shell Programming and Scripting

Function in Shell script

Legends, Can you please debug, what's wrong with the below code. I am gettng unexpected token error RebuldPF() ( #Changing the directory to data directory where the pf exists. cd /home/sandeep/files #Listing the names of the Pricefiles for rebuilding echo "The following pricefiles will... (6 Replies)
Discussion started by: sdosanjh
6 Replies

7. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

8. Shell Programming and Scripting

awk function from shell

Hi all. I have a selection of awk functions which I have written and tested in a main awk program. From the command line I use nawk -f function -f main to run main and call my functions from within it. I now wish to use these awk function again but want to call them from inside an awk section of... (1 Reply)
Discussion started by: pxy2d1
1 Replies

9. UNIX for Advanced & Expert Users

how to see function in shell

Hi, is there any way we can see user defined functions in a shell? thanks in advance, -Ashish (2 Replies)
Discussion started by: shriashishpatil
2 Replies

10. Shell Programming and Scripting

getting the value of a c function in shell script

Let say there is a module fileselection module written in c language which returns the file name. Is it possible to get the file name from the file selection module directly, I mean can we call a c function directly in shell script without doing executable. If possible then how it can be... (1 Reply)
Discussion started by: surjyap
1 Replies
Login or Register to Ask a Question
escape(1)							Mail Avenger 0.8.3							 escape(1)

NAME
escape - escape shell special characters in a string SYNOPSIS
escape string DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result. EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string: $ var='; echo gotcha!' $ eval echo hi $var hi gotcha! $ Using escape, one can avoid executing the contents of $var: $ eval echo hi `escape "$var"` hi ; echo gotcha! $ A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient: #!/bin/sh formail -x to -x cc -x resent-to -x resent-cc | fgrep "$1" > /dev/null && exit 0 echo "<$1>.. address does not accept blind carbon copies" exit 100 To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt script: bodytest reject_bcc `escape "$RECIPIENT"` SEE ALSO
avenger(1), The Mail Avenger home page: <http://www.mailavenger.org/>. BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells. AUTHOR
David Mazieres Mail Avenger 0.8.3 2012-04-05 escape(1)