Sponsored Content
Top Forums Shell Programming and Scripting assignment to variable from eval command Post 302467081 by frans on Thursday 28th of October 2010 07:18:18 AM
Old 10-28-2010
bash code:
  1. for prm in RUN_COST_PRICES_COMPARISON RUN_SELLING_PRICE_COMPARISON RUN_RATIO_PACK_COMPARISON
  2. do
  3.      echo $prm
  4.      echo ${!prm}
  5. done
Are the variables filled in your script?
to verify, add this to the the previous one:
Code:
echo "before expansion"
echo $RUN_COST_PRICES_COMPARISON
echo $RUN_SELLING_PRICE_COMPARISON
echo $RUN_RATIO_PACK_COMPARISON
echo "------------------"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

eval a variable that has a .

Hi, Is there any way that I can eval the following - eval abc.csv=def.csv I am getting the - bash: command not found error. thanks. (3 Replies)
Discussion started by: ttshell
3 Replies

2. Shell Programming and Scripting

How to assign eval value as Variable..

Im facing problem in assigning value of eval array variable as normal variable.. x=0 eval DATA${x}="FJSVcpcu" x=`expr $x + 1` eval DATA${x}="FJSVcsr" if x=0, type -> eval echo \$DATA$x , its give me FJSVcpcu i want assign this value into an variable as variable=`eval echo... (3 Replies)
Discussion started by: neruppu
3 Replies

3. Shell Programming and Scripting

bin/sh eval variable assignment

Why can't I do this? eval "TEST=5;echo $TEST;"; THIS WORKS!! TEST=5;echo $TEST; (2 Replies)
Discussion started by: blasto333
2 Replies

4. Shell Programming and Scripting

command output to variable assignment and screen simultaneously

Hello Folks, I have a script that runs a command (rsync) that sometimes takes a long time to complete and produces diagnostic output on stdout as it runs. I am currently capturing this output in a variable and using it further in the script. I would like to continue to capture this output... (2 Replies)
Discussion started by: mbm
2 Replies

5. Shell Programming and Scripting

eval and variable assignment

Hi, i have an issue with eval and variable assignment. 1) i have a date value in a variable and that date is part of a filename, var1=20100331 file1=${var1}-D1-0092.xml.zip file2=${var2}-D2-0092.xml.zip file3=${var3}-D3-0092.xml.zip i am passing the above variables to a script via... (11 Replies)
Discussion started by: mohanpadamata
11 Replies

6. Solaris

Looking to understand what this command $$ does in variable assignment?

Hi Folks, I'm looking to figure something out in an existing script I'm trying to understand. the command in question(on a Solaris Box using KSH) is: WORKDIR=/tmp/namereplaced.exec.$$.$RANDOM Now, I know it's setting the $workdir environmental variable... And I understand most of... (2 Replies)
Discussion started by: Marc G
2 Replies

7. Shell Programming and Scripting

'eval' used in variable assignment

pattern1=book { x=1 eval echo \$pattern$x } book (this is the output) But when I assign a variable to the output of the eval it doesn't work unless I prefix 2 times backslash before $ as shown below. { a=`eval echo \\$pattern$x` echo $a } book Why here twice "\" has to be... (3 Replies)
Discussion started by: ravisingh
3 Replies

8. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (1 Reply)
Discussion started by: vivek d r
1 Replies

9. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (13 Replies)
Discussion started by: vivek d r
13 Replies

10. Shell Programming and Scripting

Trouble with variable and command assignment

I have a section of a script where I want to check a log file for a certain oracle error and if there is only one error (and it is ORA-39152) then I want to email that script is complete. Otherwise email failure and log. Somehow with this while the log only has one error and it is ORA-39152, I... (5 Replies)
Discussion started by: cougartrace
5 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 07:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy