How to assign the specific value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to assign the specific value
# 1  
Old 04-20-2009
How to assign the specific value

Hi Everyone,

How to assign the specific value which return from database?

here is the return value from database -->

(return status = 0)
0 <----- this

I only need to get the "0" .. assign to another declare variable.

hope someone will help me..

Please

thank you..
# 2  
Old 04-20-2009
Not sure what the problem is here...

Why can't you do something like rc=$? after you do whatever it is you are trying to do then check, if [[ $rc -eq 0 ]]; then ... fi
# 3  
Old 04-20-2009
Hi,

For example, the return value from database is

data->> (return status = 0)
0

but i just wan to get "0" to assign into another new declaration.
if i do like this : rc=$data

rc will still get (return status = 0)
0

i just wan to get the specific "0", remove the others.

Thank you
# 4  
Old 04-20-2009
Not sure if I understand totally but I think you want the '0' after the words "return status = "? Maybe this will give you some direction...

Assuming data="(return status = 0)"

rc=`echo $data|cut -d"=" -f2|cut -c1-2`
echo data=$data
echo $rc

----
output:
data=(return status = 0)
0
# 5  
Old 04-20-2009
Thank you giannicello... the way u teach me is working fine... but i did change a bit,
Thank you so much....

The command show below is the way i changed... coz some return value is -1 or -2 or 0, and i have to get the number value is outside the branket... Thank you so much..

rc=`echo $result|cut -d")" -f2|cut -c1-3|cut -d" " -f2`
rc=-1

done...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Assign read write permission to the user for specific dir and it's sub dir and files in AIX

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies

2. Shell Programming and Scripting

awk to assign points to variables based on conditions and update specific field

I have been reading old posts and trying to come up with a solution for the below: Use a tab-delimited input file to assign point to variables that are used to update a specific field, Rank. I really couldn't find too much in the way of assigning points to variable, but made an attempt at an awk... (4 Replies)
Discussion started by: cmccabe
4 Replies

3. Solaris

Sol 10 PAM config - how to assign modules to specific users

Hi, was after some help for the following. I want to enforce local passwd authentication for service accounts and kerberos authentication for users. Solaris 11 lets me assign different PAM modules to specific users via usermod and linux lets me define via UID, but I can't find a way to do this... (0 Replies)
Discussion started by: melias
0 Replies

4. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

5. Shell Programming and Scripting

Regex in sed to find specific pattern and assign to variable

(5 Replies)
Discussion started by: radioactive9
5 Replies

6. Shell Programming and Scripting

Urgent request to consider:Search specific name in a file and fetch specific entries

Hi all, I have 2 files, One file contain data like this FHIT CS CHRM1 PDE3A PDE3B HSP90AA1 PTK2 HTR1A ESR1 PARP1 PLA2G1B These names are mentioned in the second file(Please see attached second file) as # Drug_Target_X_Gene_Name:(Where X can be any number (1-1000) (1 Reply)
Discussion started by: manigrover
1 Replies

7. Shell Programming and Scripting

Assign specific Color to the outputs in script

Hi, Im programming an interactive menu that verifies the exports of my oracle DB, and im having some trouble finding a process that outputs for example a green command line when the export terminated successfully. i have something like this cat... (15 Replies)
Discussion started by: blacksteel1988
15 Replies

8. Shell Programming and Scripting

awk assign output of array to specific field-number

With this script i want to print the output to a specific field-number . Can anybody help? awk 'NR=FNR{split(FILENAME,fn,"_");nr=$2;f = $1} END{for (i=1;i<=f;i++) print i,$fn=nr}' input_5.csv input_6.csvinput_5.csv 4 135 5 185 6 85 11 30input_6.csv 1 90 3 58 4 135 7 60 8 55 10... (1 Reply)
Discussion started by: sdf
1 Replies

9. Shell Programming and Scripting

Assigning a specific format to a specific column in a text file using awk and printf

Hi, I have the following text file: 8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm 9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm 10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm 11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies
Login or Register to Ask a Question