Sponsored Content
Top Forums Programming how do u assign the values to different variables when it is presneted in one line?? Post 87466 by SwetaShah on Monday 24th of October 2005 12:47:44 PM
Old 10-24-2005
MySQL how do u assign the values to different variables when it is presneted in one line??

hey people..
i have a configuration file that looks like
7080 7988
net04.xxxxx.edu
20

where 20 is the number of threads in the thread pool initially.
net04.xxxxx.edu is the hostname.
and 7080 7988
are two ports. first one for client requests and second one for dns communication. now my problem is,
how will i split these two?
if i read line, it will read both values..
do i read them as two separate arguments?
do i check for a space in between and then take them up respectively?
are there suggestions ?? lemme know pls.
bye bye

Last edited by SwetaShah; 10-24-2005 at 01:48 PM.. Reason: wrong title.. sorry!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I assign values to variables made in a script?

How do I assign values to variables made in a script? e.g. for ((x=0;x<=5;i+=1)); do Xm$i=$var done (0 Replies)
Discussion started by: gelitini
0 Replies

2. Shell Programming and Scripting

how can i read text file and assign its values to variables using shell

Hello, I have a cat.dat file, i would like shell to read each 3 lines and set this 3 lines to 3 different variables. my cat.dat is: 11 12 +380486461001 12 13 +380486461002 13 14 +380486461003 i want shell to make a loop and assign 1st line to student_id, 2nd line to... (4 Replies)
Discussion started by: rosalinda
4 Replies

3. Shell Programming and Scripting

Assign Values to variables from a text file

The text file has one single row and looks like this Q1 P1 2006 I have to pick up this values from a shell script into three different variables, say quarter, period and year from the above text file. Some one know's how to do this? I went through 'sed', dint really know how to... (3 Replies)
Discussion started by: sarsani
3 Replies

4. Shell Programming and Scripting

Assign values to variables of a file

Hi, I have a file like the following... CUST= DIR= NULIST= name=philps_123 How can i add values to each of these unassigned variables using a shell script? say for eg: i have values for CUST as onida, dir as /dir/onida, NULIST as /tmp/onida_files. How can i add these values to... (11 Replies)
Discussion started by: Tuxidow
11 Replies

5. Shell Programming and Scripting

Need to parse lines in a file into two words and assign the values to two variables

For example, I have a file with below lines containing VOB tags and VOB paths. * /vobs/fts/FTSUSM20_VOB /ccvobsslx01/projects/vobs/eml/FTSUSM20_VOB * /vobs/fts/FTS20_VOB /ccvobsslx01/projects/vobs/eml/FTS20_VOB * /vobs/pmv/PMS_VOB /ccvobsslx01/projects/vobs/cpm/_/PMS_VOB *... (4 Replies)
Discussion started by: senthilkc
4 Replies

6. Shell Programming and Scripting

Read variables names from array and assign the values

Hi, I have requirement to assign values to variables which are created dynamically. Below is the code which i am using to achieve above requirement. #!/bin/ksh oIFS="$IFS"; IFS=',' STR_FAIL_PARENT_IF_FAILS="WF_F_P_IF_FAILS1,WF_F_P_IF_FAILS2,WF_F_P_IF_FAILS3" set -A... (1 Reply)
Discussion started by: tmalik79
1 Replies

7. Shell Programming and Scripting

Unable to read assign values to two variables in while loop

I am trying to read a input file which has two columns separated by space Input file server1 server2 server3 server4 server5 server6 When i execute the below while code it reads line by line and a and b variables are able to successfully fetch the values while read a b do echo "$a" echo... (5 Replies)
Discussion started by: chidori
5 Replies

8. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

9. Shell Programming and Scripting

A better way to assign values to variables - shell

so i've been used to doing it this way: SVAL=$(echo "7 3 2 38 3" | awk '{print $2}') 4VAL=$(echo "4:21:N:3" | awk -F":" '{print $4}') I know there's a way to do it by putting the value in an array and assigning it that way. but i'm not sure how to do it efficiently. any ideas? i dont... (9 Replies)
Discussion started by: SkySmart
9 Replies

10. Shell Programming and Scripting

Assign Unknown Values to Variables

i have a program that spits out a certain number of values. i dont know the number of values. they can be 4, 10, 7, 20, no idea. but, i want to be able to assign each of the value returned by this program to a variable. in the latest instance, the program gave the following 6 values: 4... (8 Replies)
Discussion started by: SkySmart
8 Replies
door_bind(3DOOR)					      Door Library Functions						  door_bind(3DOOR)

NAME
door_bind, door_unbind - bind or unbind the current thread with the door server pool SYNOPSIS
cc -mt [ flag... ] file... -ldoor [ library... ] #include <door.h> int door_bind(int did); int door_unbind(void); DESCRIPTION
The door_bind() function associates the current thread with a door server pool. A door server pool is a private pool of server threads that is available to serve door invocations associated with the door did. The door_unbind() function breaks the association of door_bind() by removing any private door pool binding that is associated with the cur- rent thread. Normally, door server threads are placed in a global pool of available threads that invocations on any door can use to dispatch a door invocation. A door that has been created with DOOR_PRIVATE only uses server threads that have been associated with the door by door_bind(). It is therefore necessary to bind at least one server thread to doors created with DOOR_PRIVATE. The server thread create function, door_server_create(), is initially called by the system during a door_create() operation. See door_server_create(3DOOR) and door_create(3DOOR). The current thread is added to the private pool of server threads associated with a door during the next door_return() (that has been issued by the current thread after an associated door_bind()). See door_return(3DOOR). A server thread performing a door_bind() on a door that is already bound to a different door performs an implicit door_unbind() of the previous door. If a process containing threads that have been bound to a door calls fork(2), the threads in the child process will be bound to an invalid door, and any calls to door_return(3DOOR) will result in an error. RETURN VALUES
Upon successful completion, a 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The door_bind() and door_unbind() functions fail if: EBADF The did argument is not a valid door. EBADF The door_unbind() function was called by a thread that is currently not bound. EINVAL did was not created with the DOOR_PRIVATE attribute. EXAMPLES
Example 1: Use door_bind() to create private server pools for two doors. The following example shows the use of door_bind() to create private server pools for two doors, d1 and d2. Function my_create() is called when a new server thread is needed; it creates a thread running function, my_server_create(), which binds itself to one of the two doors. #include <door.h> #include <thread.h> #include <pthread.h> thread_key_t door_key; int d1 = -1; int d2 = -1; cond_t cv; /* statically initialized to zero */ mutex_t lock; /* statically initialized to zero */ extern void foo(void *, char *, size_t, door_desc_t *, uint_t); extern void bar(void *, char *, size_t, door_desc_t *, uint_t); static void * my_server_create(void *arg) { /* wait for d1 & d2 to be initialized */ mutex_lock(&lock); while (d1 == -1 || d2 == -1) cond_wait(&cv, &lock); mutex_unlock(&lock); if (arg == (void *)foo){ /* bind thread with pool associated with d1 */ thr_setspecific(door_key, (void *)foo); if (door_bind(d1) < 0) { perror("door_bind"); exit (-1); } } else if (arg == (void *)bar) { /* bind thread with pool associated with d2 */ thr_setspecific(door_key, (void *)bar); if (door_bind(d2) < 0) { /* bind thread to d2 thread pool */ perror("door_bind"); exit (-1); } } pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); door_return(NULL, 0, NULL, 0); /* Wait for door invocation */ } static void my_create(door_info_t *dip) { /* Pass the door identity information to create function */ thr_create(NULL, 0, my_server_create, (void *)dip->di_proc, THR_BOUND | THR_DETACHED, NULL); } main() { (void) door_server_create(my_create); if (thr_keycreate(&door_key, NULL) != 0) { perror("thr_keycreate"); exit(1); } mutex_lock(&lock); d1 = door_create(foo, NULL, DOOR_PRIVATE); /* Private pool */ d2 = door_create(bar, NULL, DOOR_PRIVATE); /* Private pool */ cond_signal(&cv); mutex_unlock(&lock); while(1) pause(); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |all | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
fork(2),door_create(3DOOR), door_return(3DOOR), door_server_create(3DOOR), libdoor(3LIB), attributes(5) SunOS 5.10 23 Apr 2003 door_bind(3DOOR)
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy