function in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting function in UNIX
# 8  
Old 02-26-2009
I know. Try the solution. It will work.
function pass_or_fail
{
# at this point the pass_or_fail function does not know any value for i
# but the 1st parameter passed to it is available as $1
# to get that in a variable called i I must do:
i=$1
# Wow , now i has a value!

if [ -s fail/${df[$i]} ]
then
echo " ${df[$i]} FAILED. Please check logs"

elif [ -s pass/${df[$i]} ]
then
echo " ${df[$i]} PASSED."
fi
}

Try that.
# 9  
Old 02-26-2009
oh my God it works!

trx data loading :
trx PASSED.

xml data loading :
xml PASSED.

Thank you so much Perderabo and Hard Aix Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String Function in UNIX

Hi - Have file1 which has the below date 08/31/2018 And also have file2 which has the below texts ASOF:<CMODate> FUND I need to read the second file if it has colon (:) then move the date from first file to second file like this ASOF:08/31/2018 have used cut -d":" -f1 and moved the... (2 Replies)
Discussion started by: Mohan0509
2 Replies

2. Shell Programming and Scripting

UNIX Date function with -d options

Hi , I couldn't understand how this program works. Can somebody please explain it to me. DT=`date -d "1 day"` # This part I understand echo ${DT/ */} # How this works echo ${DT/* /} (2 Replies)
Discussion started by: LoneRanger
2 Replies

3. Shell Programming and Scripting

Split function in HP UNIX

hi all, i have large file. where i need the split the files into two files. can anyone tell me what is the command for that? Unix OS :HP Unix. Thanks, arun. (2 Replies)
Discussion started by: arun888
2 Replies

4. Shell Programming and Scripting

Sort function UNIX bug ???

Hello there i have a funny behiavor of the sort fonction, i try it out on different Solaris machine and i have the same issue. So i would like to see if there is a rationel explanation here is some data in a file:test.txt ,Test,RSD,RSD_Asset ,Test,RSD,RSD_Credit ,Test,RSD,RSD_Liab... (3 Replies)
Discussion started by: kykyboss
3 Replies

5. Shell Programming and Scripting

UNIX function

I have a code like this v_time=12:12:12 correctTimeFlag=$(echo $v_time|awk '{for(i=1;i<=NF;i++) if( $i ~ /::/){print i}}') if then echo "correct" fi I need a equivalent function to replace the line correctTimeFlag=$(echo $v_time|awk '{for(i=1;i<=NF;i++) if( $i ~... (3 Replies)
Discussion started by: swayam123
3 Replies

6. Solaris

function parameter in unix

Hi, How to use a function with passing value as a parameter in unix ? With Regards (7 Replies)
Discussion started by: milink
7 Replies

7. Shell Programming and Scripting

Recursive function in unix

Can someone tell me, how do i write a recursive code using shell ( eg like 'for' loop in C) which outputs the record to a database table as one row per iteration? (7 Replies)
Discussion started by: goutam_igate
7 Replies

8. UNIX for Dummies Questions & Answers

Trouble with UNIX tr (translate) function

UNIX script - problem. I want the spaces in my Item variable to be replaced with a question mark. Can you tell me what I am doing wrong? This is the whole code line. Item | tr -s " " "?" Why is this not making any changes to the Item value? Thanks for any help you can give! tg (2 Replies)
Discussion started by: by_tg
2 Replies

9. Cybersecurity

Function of Javascript within Unix Network

What attacks can a Unix box get through Javascript? Is the Web Client secure against Javascript attacks if any? Do we have a Trojan horse made in JavaScript? (3 Replies)
Discussion started by: netass
3 Replies

10. Programming

decrypt function in unix?

Hai Friends We have a function called char * crypt(const char *ps, const char* key) to encrypt the password in the unix environment.. Do we have any decrypt function to decrypt it? If not then how can we verify the password through program? Thanks in Advance Collins (1 Reply)
Discussion started by: collins
1 Replies
Login or Register to Ask a Question