Sponsored Content
Top Forums Shell Programming and Scripting How to evaluate a variable name on LHS of expression? Post 302886800 by RudiC on Monday 3rd of February 2014 05:13:11 PM
Old 02-03-2014
You can't do that. You'll have to
- read $parm < someredirection
- assign to an associative array X[$parm]=...
- eval $parm=... (which brings with it all sorts of escaping needs etc.)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to get variable to re-evaluate itself?

Probably a simple one. Basically I am retrieving a number from a file - setting a variable against it and then incrementing this by 1 and using this as an entry number in a log file for messages. I need the variable to re-evalute itself each time I call it so I get the latest number in the file -... (1 Reply)
Discussion started by: frustrated1
1 Replies

2. Shell Programming and Scripting

Evaluate the value of a variable?

I have variables: FOO="Text" BAR="FOO" I'd like to be able to evaluate the variable named as the value of $BAR. echo $FOO Text echo $BAR FOO This is what I'd like to do: echo ${$BAR} (this won't work) Text (3 Replies)
Discussion started by: Ilja
3 Replies

3. Shell Programming and Scripting

Evaluate string containing shell variable names

Hello, I have this: #!/usr/bin/ksh V1=ABC str="hello 123;${V1}" eval "echo $str" i get hello 123 /script.sh ABC not found However eval works if $str variable doesn't contain a semicolumn (eg if str="hello 123~${v1}" running the eval statement above would produce (2 Replies)
Discussion started by: endorphin
2 Replies

4. Shell Programming and Scripting

Variable expression and while

hi, i'm reading a file "LISTE_FILE" like : # $LOGCOM * 5 $PRCCOM * 10 and i want to use the file with "while" and having the fields splitted into new variables for treatment : while read LINE do # Ignorer les commentaires un # en premiere position if then... (3 Replies)
Discussion started by: Nicol
3 Replies

5. Shell Programming and Scripting

How to evaluate the value of a variable ?

How to evaluate the value of a variable ? For example: a=var $a=value !!!error happens!!! I want to evaluate var=value, how to realize it? Thanks! ---------- Post updated at 03:37 AM ---------- Previous update was at 02:22 AM ---------- I am using linux bash. a=var $a=value... (4 Replies)
Discussion started by: 915086731
4 Replies

6. Shell Programming and Scripting

Using a variable as a for loop expression

I'm writing a script to merge the xkcd webcomic tiles for comic 1110. So far, I have written about 100 lines, and instead of doing each quadrant of the image separately, I've decided to use functions to do this, repeating for every quadrant and using variables for each quadrant to make the function... (9 Replies)
Discussion started by: jbondhus
9 Replies

7. Shell Programming and Scripting

Trying to execute a expression in a variable

Hi i tried to execute a below script but it is giving execution error rec=ABC,1234,55.00 Colno=2 coldel=, fd='"'$coldel'"' fprint="'"'{print$'$colno'}'"'" colsyn=`echo "echo "$rec "| awk -F"$fd $fprint` echo column syntax is $colsyn colrec=`colsyn` echo column is $colrec (5 Replies)
Discussion started by: ragu.selvaraj
5 Replies

8. Shell Programming and Scripting

Evaluate Variable At Runtime

Hi, I am trying to set a variable that has time the format desired. And my intention is to echo variable (instead of actual date command) everytime I like to echo date. Please take a look at below code. $NOW='' echo $NOW After 5 minutes $echo $NOW Issue here is , I am not... (2 Replies)
Discussion started by: vinay4889
2 Replies

9. Shell Programming and Scripting

Evaluate Expression within awk

I want to create a conditional expression string and pass in an awk script. My script is as below... comm="\$3 == "hello"" awk -F "^T" -v command="${comm}" ' { if ( command ) { print "hye" } }' testBut the statement "if ( command )" always evaluates to true which is not... (5 Replies)
Discussion started by: Saikat123
5 Replies

10. UNIX for Advanced & Expert Users

How to evaluate expression under awk?

I have to display only those subscribers which are in "unconnected state" and the date is 90 days older than today's date. Below command is used for this purpose: cat vfsubscriber_20170817.csv | sed -e 's/^"//' -e '1d' | \ nawk -F '",' '{if ( (substr($11,2,4) == 2017) && ( substr($11,2,8)... (1 Reply)
Discussion started by: dia
1 Replies
putctl(9F)						   Kernel Functions for Drivers 						putctl(9F)

NAME
putctl - send a control message to a queue SYNOPSIS
#include <sys/stream.h> int putctl(queue_t *q, int type); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
q Queue to which the message is to be sent. type Message type (must be control, not data type). DESCRIPTION
putctl() tests the type argument to make sure a data type has not been specified, and then attempts to allocate a message block. putctl() fails if type is M_DATA, M_PROTO, or M_PCPROTO, or if a message block cannot be allocated. If successful, putctl() calls the put(9E) routine of the queue pointed to by q with the newly allocated and initialized messages. RETURN VALUES
On success, 1 is returned. If type is a data type, or if a message block cannot be allocated, 0 is returned. CONTEXT
putctl() can be called from user or interrupt context. EXAMPLES
Example 1: Using putctl() The send_ctl() routine is used to pass control messages downstream. M_BREAK messages are handled with putctl() (line 11). putctl1(9F) (line 16) is used for M_DELAY messages, so that parm can be used to specify the length of the delay. In either case, if a message block cannot be allocated a variable recording the number of allocation failures is incremented (lines 12, 17). If an invalid message type is detected, cmn_err(9F) panics the system (line 21). 1 void 2 send_ctl(wrq, type, parm) 3 queue_t *wrq; 4 uchar_t type; 5 uchar_t parm; 6 { 7 extern int num_alloc_fail; 8 9 switch (type) { 10 case M_BREAK: 11 if (!putctl(wrq->q_next, M_BREAK)) 12 num_alloc_fail++; 13 break; 14 15 case M_DELAY: 16 if (!putctl1(wrq->q_next, M_DELAY, parm)) 17 num_alloc_fail++; 18 break; 19 20 default: 21 cmn_err(CE_PANIC, "send_ctl: bad message type passed"); 22 break; 23 } 24 } SEE ALSO
put(9E), cmn_err(9F), datamsg(9F), putctl1(9F), putnextctl(9F) Writing Device Drivers STREAMS Programming Guide SunOS 5.10 11 Apr 1991 putctl(9F)
All times are GMT -4. The time now is 08:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy