Sponsored Content
Top Forums Programming How to refer to variable (korn shell)? Post 302424567 by presul on Tuesday 25th of May 2010 05:24:38 PM
Old 05-25-2010
Question How to refer to variable (korn shell)?

Hi

I have the following block of code in korn shell and don't now how to refer to variable `print variable1.$dvd` ?


---
Code:
integer dvd=4
integer number=0

while (( dvd!=0 ))
do

     [ `print variable1.$dvd`="$number" ]

     print "Iteracja numer : $dvd"
     print "$_"    #it refers to $dvd var but want to refer `print variable1.$dvd`
     
     (( number=$number+1 ))
     (( dvd=$dvd-1 ))

done

---

Generally I want to have at each iteration a new variable with different name referred to it.


thx for help.

Last edited by pludi; 05-26-2010 at 01:58 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding Occurence of comma in a Variable ( KORN Shell)

All I want to find the occurence of comma in a variable in KORN shell. For example : var = test,test2,test3 .... finding occurence of comma in this variable. Result = 3 now. Please help me to write the code. Thanks in advance. Regards Deepak (2 Replies)
Discussion started by: DeepakXavier
2 Replies

2. Shell Programming and Scripting

how to refer one variable using another

Hi, How will you refer one variable's value using another in unix? For e.g Take the case System1_ip=172.120.20.54 And in latter part of the program while I'm using the values in a for loop I use i=System1 j=${i}_ip k=$j But K's value at the end of the run is System1_ip I want... (2 Replies)
Discussion started by: dayanandra
2 Replies

3. Shell Programming and Scripting

compound variable in korn shell

in a text " Korn Shell Unix programming Manual 3° Edition" i have found this sintax to declare a compoud variable: variable=( fild1 (0 Replies)
Discussion started by: ZINGARO
0 Replies

4. Shell Programming and Scripting

compound variable in korn shell

in a text " Korn Shell Unix programming Manual 3° Edition" i have found this sintax to declare a compoud variable: variable=( fild1 fild1 ) but this sintax in ksh and sh (HP-UNIX) not work... why?? exist another solution for this type of variable ??? (5 Replies)
Discussion started by: ZINGARO
5 Replies

5. Shell Programming and Scripting

Korn Shell Variable values difference

I am using two shell scripts a.ksh and b.ksh a.ksh 1. Sets the value +++++++++++++++++ export USER1=abcd1 export PASSWORD=xyz +++++++++++++++++ b.ksh 2. Second scripts calls sctipt a.ksh and uses the values set in a.ksh and pass to an executable demo... (2 Replies)
Discussion started by: kunalseth
2 Replies

6. Shell Programming and Scripting

Setting variable for query using iSql / Korn Shell

Hi All- First time using iSql. I have 4 query files - some have more than 1 line of sql statements After a bit of research it appears I can just use the -i command and specify the input file. Questions: Does it matter that there are multiple queries in each file? Do I need to have... (3 Replies)
Discussion started by: Cailet
3 Replies

7. Shell Programming and Scripting

korn shell: check the content of a string of a variable

hello, i have a variable which should have following content : var="value1" or var="value2" or var="value2:*" # example: value2:22 how can i check : - if the content is ok (value1 / value2* ) - the two options of "value2" when content is example "value2:22" , i want to split... (3 Replies)
Discussion started by: bora99
3 Replies

8. Shell Programming and Scripting

Korn Shell help - Using parameter to create variable names

I'm using korn shell and I am wondering if it's possible to use a parameter passed into a function to build a variable name in a configuration file. I have the function in one source file, I'd like to have a global configuration file instead of hardcoding logins to each script. So I have a... (7 Replies)
Discussion started by: mrevello
7 Replies

9. UNIX for Dummies Questions & Answers

How to import a variable Used in Another Korn Shell Script?

Hi I am using two shell scripts which are running on the system simultaneously. And in one of the script i am exporting an Integer Variable. Now i want to use the variable in another script. But i cannot run the first script in the second as the first script has many other functions which... (3 Replies)
Discussion started by: Ajesh
3 Replies

10. Shell Programming and Scripting

[Solved] How to refer more than 9 command line inputs for a scripts in korn shell?

Hi all, I have a script which should take more than 9 command line inputs while running. Likescript.sh a s d f g h j j k l o p i u y t r e w Now in the script if I have to access one of the input which is at position after 9, in this case say 'p' then how can I do that? echo $12 will not work... (15 Replies)
Discussion started by: pat_pramod
15 Replies
TGTIMG(8)																 TGTIMG(8)

NAME
tgtimg - Linux SCSI Target Framework Image File Utility SYNOPSIS
tgtimg [-o --op <operation>] [-Y --device-type <device-type>] [-b --barcode <barcode>] [-s --size <size>] [-t --type <media-type>] [-f --file <path>] tgtimg --help DESCRIPTION
Tgtimg is a utility to create and manage the image files used by the TGTD device emulation. This command is used to initialize device image files with the additional metadata, such as barcode, list of blocks, total size, etc that the TGTD emulation needs. OPTIONS
-h, --help Show a help screen and exit. -o, --op {new|show} Operation. Is either new to create a new image file or show to show the content of an existing image file. -Y, --device-type <type> This specifies the type of image file. Supported device types are : cd : to create media for a dvd device disk : to create media for a disk device tape : to create media for a tape device -t, --type <media-type> When creating a new image, this specifies the type of media to emulate. The available mediatypes depend on the type of the device. Supported media types for cd devices are : dvd+r : create a blank writeable DVD+R disk Supported media types for disk devices are : disk : create an empty disk Supported media types for tape devices are : data : create a normal data tape clean : create a cleaning tape worm : create a worm -b, --barcode <barcode> When creating a new image, this argument specifies the barcode to use with this image file. Backup application software often uses barcodes to identify specific tapes. When emulating a VTL, make sure that all tape images use unique barcodes. -s, --size <size> When creating a new image, this specifies the size in megabytes for the virtual tape image. -f, --file <path> The filename of the image file. EXAMPLES
To create a new 100MByte disk tgtimg --op new --device-type disk --type disk --size 100 --file /data/hd001.raw To create a new tape image tgtimg --op new --device-type tape --barcode 12345 --size 100 --type data --file /data/tape001.img To view the content of an existing image tgtimg --op show --device-type tape --file /data/tape001.img To create a new blank DVD+R image tgtimg --op new --device-type cd --type dvd+r --file /data/dvd001.iso SEE ALSO
tgtd(8), tgtadm(8), tgt-admin(8), tgt-setup-lun(8). http://stgt.sourceforge.net/ REPORTING BUGS
Report bugs to <stgt@vger.kernel.org> 04/04/2010 TGTIMG(8)
All times are GMT -4. The time now is 08:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy