Sponsored Content
Top Forums Shell Programming and Scripting How to evaluate a variable name on LHS of expression? Post 302886801 by Chubler_XL on Monday 3rd of February 2014 05:26:16 PM
Old 02-03-2014
In bash you can use printf -v like this:

Code:
function getParams {
for param in $@
do
   printf -v "$param" "%s" "$(./db2 +w -x "SELECT PARM_VALUE_TXT FROM ${FRMWRK_DB_SCHEMA}.JOB_PARM WHERE PARM_NM='$param' WITH UR")"
done
}

getParams parm1 parm2 parm3

 

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
PTHREAD_SETSCHEDPARAM(3)				     Library Functions Manual					  PTHREAD_SETSCHEDPARAM(3)

NAME
pthread_setschedparam, pthread_getschedparam - control thread scheduling parameters SYNOPSIS
#include <pthread.h> int pthread_setschedparam(pthread_t target_thread, int policy, const struct sched_param *param); int pthread_getschedparam(pthread_t target_thread, int *policy, struct sched_param *param); DESCRIPTION
pthread_setschedparam sets the scheduling parameters for the thread target_thread as indicated by policy and param. policy can be either SCHED_OTHER (regular, non-realtime scheduling), SCHED_RR (realtime, round-robin) or SCHED_FIFO (realtime, first-in first-out). param spec- ifies the scheduling priority for the two realtime policies. See sched_setpolicy(2) for more information on scheduling policies. The realtime scheduling policies SCHED_RR and SCHED_FIFO are available only to processes with superuser privileges. pthread_getschedparam retrieves the scheduling policy and scheduling parameters for the thread target_thread and store them in the loca- tions pointed to by policy and param, respectively. RETURN VALUE
pthread_setschedparam and pthread_getschedparam return 0 on success and a non-zero error code on error. ERRORS
On error, pthread_setschedparam returns the following error codes: EINVAL policy is not one of SCHED_OTHER, SCHED_RR, SCHED_FIFO EINVAL the priority value specified by param is not valid for the specified policy EPERM the calling process does not have superuser permissions ESRCH the target_thread is invalid or has already terminated EFAULT param points outside the process memory space On error, pthread_getschedparam returns the following error codes: ESRCH the target_thread is invalid or has already terminated EFAULT policy or param point outside the process memory space AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr> SEE ALSO
sched_setscheduler(2), sched_getscheduler(2), sched_getparam(2), pthread_attr_setschedpolicy(3), pthread_attr_setschedparam(3). LinuxThreads PTHREAD_SETSCHEDPARAM(3)
All times are GMT -4. The time now is 10:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy