Sponsored Content
Top Forums Shell Programming and Scripting How to set a variable name from another variables value? Post 302781361 by Yoda on Saturday 16th of March 2013 09:40:18 AM
Old 03-16-2013
You can use eval in this scenario:
Code:
eval d$i=$L ;  echo $d5

But I recommend to stay away from eval because using it is a security risk.

Array is the best choice for you here:
Code:
d[$i]=$L ;  echo ${d[$i]}

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to set up linux environment variables?

Hi I'm using Linux, in the directory /root/my there is a.out. but when I try to run it , the shell indicate "bash:a.out: command not found" but I AM working in this directory. if I use "./a.out" , it works perfectly. can any body tell me how to do a permanent set up so that I can use... (5 Replies)
Discussion started by: dell9
5 Replies

2. UNIX for Dummies Questions & Answers

Using Variables to Set Other Variables

I have a script that I'm trying to shorten (below) by removing repetitive code. if ] then commodity_ndm_done=Y fi if ] then customer_ndm_done=Y fi if ] then department_ndm_done=Y fi if ] then division_ndm_done=Y fi (3 Replies)
Discussion started by: superdelic
3 Replies

3. UNIX for Advanced & Expert Users

by using c++ how to set environment variables in unix

hi, I am writing c++ code in unix operating system.In that i need to set the environment variable in unix. suppose previously i have environment variable like path="something" now i need to change the path value to some othervalue . so that some other program will access that path value... (1 Reply)
Discussion started by: sada@123
1 Replies

4. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

5. UNIX for Dummies Questions & Answers

Where are Oracle variables set in Solaris 5.9

Hi, It is solaris 5.9, and Oracle 10G is the database. If i login as user, and give 'env' command i can see the Oracle environment variables are set. PATH=/usr/bin:/usr/sbin:/usr/lib:/etc/ssh:/opt/oracle/app/oracle/product/10.2.0/db_1/bin:/opt/oracle/crs/oracle/product/10.2.0/crs_1/bin... (1 Reply)
Discussion started by: scriptlearner
1 Replies

6. AIX

How to set permanent variables

I set my TERM variable to work with SMIT and everything works fine but when I logged out and log in again I have to set the variable again. How can I set a permanent variable into the system so it will be as I wish even if a reboot is needed? I set variables this way: export VAR=value (7 Replies)
Discussion started by: agasamapetilon
7 Replies

7. UNIX for Dummies Questions & Answers

Why does set also change setenv variables?

I thought that set and setenv was easy enough to understand until I started experimenting. I noticed the same problem in a previous thread, so I will use it as an example. set command gave the following output: argv () cwd /homes/e/ee325328/assignment.2 home /homes/e/ee325328 path ( a... (2 Replies)
Discussion started by: benwj
2 Replies

8. Shell Programming and Scripting

Problems with expect and set variables

I'm writing a script that'll send a time-stamp to my backup server. I create a file with the name of the current date, send it to my server with scp and rm the file from the local computer. Individually these commands work fine and with a set name the expect scripts also work fine. The problem... (0 Replies)
Discussion started by: Ktesh564
0 Replies

9. HP-UX

What is the use of command set -- and set - variable?

Hi, I am using hp unix i want to know the use of the following commands set -- set - variable thanks (4 Replies)
Discussion started by: gomathi
4 Replies

10. Shell Programming and Scripting

Need to SET Environment variables

Hi Could you please tell me how to set environment variables in Unix ksh. And how can acess those varibles in shell scripts ( Please give the code with an example) For my scenario. We have written number of shell scripts with hard coded username and password. But if we want to... (1 Reply)
Discussion started by: shyamu544
1 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy