Sponsored Content
Top Forums Shell Programming and Scripting Safe way to eval variable declarations? Post 302911294 by Chubler_XL on Thursday 31st of July 2014 02:49:43 AM
Old 07-31-2014
It gets the value of the variable "expand" and treats this as a variable name and the fetches its value.

So
Code:
$ t=5
$ x=t
$ y=x
$ echo ${!x}
5
$ echo ${!y}
t

This User Gave Thanks to Chubler_XL For This Post:
 

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

Passing eval value to a variable

Hello, I have a script that does an scp to a server and then gets the number of process running on that server, the o/P should be stored in a variable for further processing eval `echo "ssh -q $Infa_user@$host 'csh -c $CMD '"` where CMD="ps -ef | grep -i ${INFA_REPO} | grep -v grep | wc... (2 Replies)
Discussion started by: amit1_x
2 Replies

5. Shell Programming and Scripting

Help with eval usage for string containing Environment Variable

Help !! First, Thanks in Advance Here is what I have I have an environment Variable, let's call it v_VALUE. v_VALUE="\$ORACLE_HOME/bin" Hence, the location is ORACLE_HOME is not evaluated. ORACLE_HOME happens to be /app/oracle/product/10.1.2 I need a method of returning the... (1 Reply)
Discussion started by: dhangliter
1 Replies

6. 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

7. Shell Programming and Scripting

assignment to variable from eval command

Hi Gurus, I am having 2 parameters as below parm1=value1 parm2=parm1 I want to evaluate parm1 value using eval echo \$$parm2 and later i want to assign this value to other variable which i will be using in if statement like : if ]; then do this....... fi could you please suggest... (5 Replies)
Discussion started by: k_vikash
5 Replies

8. UNIX for Advanced & Expert Users

Variable assignments specified with eval shell built-in

According to the POSIX specifications eval is a special shell built-in, which should imply that variable assignments specified together with it should remain in effect after the built-in completes. Thus one would expect IFS to be changed after this: var=$'a\nb c' $ IFS=$'\n' eval ' for i in... (4 Replies)
Discussion started by: Scrutinizer
4 Replies

9. Shell Programming and Scripting

assign multiple rows value to a variable using eval

background : Solaris, ksh metresult="ooo > pp" ts=89 eval append_${ts}="$metresult" bash: pp: command not found I want to create a variable which has in a part of its name a dynamically-established number (stored in another variable) usually I do this with eval command. The problem I... (5 Replies)
Discussion started by: black_fender
5 Replies

10. 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
NETSCRIPT-2.2.conf(5)                                           File Formats Manual                                          NETSCRIPT-2.2.conf(5)

NAME
/etc/netscript/network.conf - interface, firewalling, and QoS configuration file. /etc/netscript/if.conf - interface setup shell script file /etc/netscript/qos.conf - QoS setup shell script file /etc/netscript/ipfilter.conf - IP chains filtering shell script file /etc/netscript/srvfilter.conf - server IP filter shell script file DESCRIPTION
This manpage is a place holder until something better is written when the netscript itself has stopped changing rapidly. Please see the README file in the /etc/netscript directory, and READ the configuration files if you need to change them. Apart from net- work.conf, all of them contain sh (1) shell script functions which are there so that various things can be altered or hooked in at the right place. Network.conf contains the full network setup details, including special interface setup for the likes of ciped/pppd/wanconfig, and is fully commented with examples given. UPGRADE PATH FROM KERNEL 2.2.X The firewall/IP filtering stuff in ipfilter.conf is the part that changed radically with the move to iptables and a far better way of set- ting up the IP filtering rules, however the QoS and interface startup/shutdown in if.conf have changed but are backwards compatible with the old 2.2.x ipchains version of netscript for the interface address configuration settings. You will have to set up the filtering again to use iptables by directly using the iptables commands. Also, the kernel 2.2.x version scripts are set up so that iptables is only run on a 2.4.x kernel, otherwise IP forwarding is disabled if beforehand you set IPFWDING_KERNEL to FILTER_ON in network.conf. This means that when you upgrade a box to a 2.4.x router kernel, you should then be able to reboot it and log into remotely and upgrade netscript to the version that will support 2.4.x. In this situation, if you have set old IPFWDING_KERNEL setting to FILTER_ON beforehand in network.conf, all IP forwarding through the box will also be disabled. This means that you can safely remotely upgrade a firewall. SEE ALSO
netscript(8), ipchains(8), iproute(8), brcfg(8). AUTHOR
This manual page was written by Matthew Grant <grantma@anathoth.gen.nz>, for the Debian GNU/Linux system (but may be used by others). BUGS
The author is lazy. He needs to write btter man pages... November 23, 2000 NETSCRIPT-2.2.conf(5)
All times are GMT -4. The time now is 07:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy