Sponsored Content
Top Forums Shell Programming and Scripting store multiple variables in one go Post 302421456 by lavascript on Friday 14th of May 2010 10:28:06 AM
Old 05-14-2010
Thanks dudes.

set -A array does the trick.

I couldn't get eval working surprisingly, as i've used that before successfully. I'll just go with what works as time is always an issue Smilie

Cheers
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract numbers from a string and store in variables

Hi All, Is it possible in Unix shell script to extract numbers from a string containing ".", such as; 5.2.314 And store in variables so; var1 = 5 var2 = 2 var3 = 314 Thanks in advance for any help anyone can provide dave (6 Replies)
Discussion started by: davewg
6 Replies

2. UNIX for Dummies Questions & Answers

trying to store variables in an array

im looping through an array setting three variables each time (one of the variables gives me the position in the array and is incremented each loop) im trying to then set the variables to that position in the array without much luck. any ideas? anArray=`$VAR1+$VAR2+"("$pos")"` (1 Reply)
Discussion started by: magnia
1 Replies

3. Shell Programming and Scripting

[Doubt] How can I store numbers less than 1? Shell variables

Hi everyone, I am having some problems with my scripts so I hope you could help me. I am trying to store the result of a division in a variable in tcshell but I have the problem that if: For example, dividing 2/100 the result is 0.02 but if I store that I have "0". How can I have 0.02... (8 Replies)
Discussion started by: Bloody
8 Replies

4. Shell Programming and Scripting

Parse config file and store the values in variables

Hi, I have a config file that has blank, commented lines. I need to escape commented lines, blank lines, parse the remaining lines and store them in variables or array. the config file contains the following lines. # config file # Define Oracle User ORA_USER=abcde ORA_PASS=xyzabc... (8 Replies)
Discussion started by: Lakshmi Chowdam
8 Replies

5. Shell Programming and Scripting

Split lines in a file and store them in variables

Hi, I have a file called files.txt which contains data like http://abc.xyz.com/ghi/klm/nop/qrs/tuv/wxyz/ There are multiple lines like the above in this file. In .sh script, I would like to read this file, split each line, and store the variable of "qrs" and "wxyz" in separate variables. ... (3 Replies)
Discussion started by: archana.n
3 Replies

6. Shell Programming and Scripting

saving all input name and store them as variables

Hi I want to write a script such that when executed, it will store all input as different variable, for eg ./store.sh name1 name2 name3 name4 will result in $1=name1 $2=name2 $3=name3 etc How do I do that? Thanks. (1 Reply)
Discussion started by: piynik
1 Replies

7. Shell Programming and Scripting

Can -v option in awk be used to store an array of variables?

I want to pass an array of variables to be inserted by awk in the 2nd column of a file. Empl No. Employee Age 1000000 22 1100000 24 1200000 26 Now, I want to pass an array having three different ages which need to replace the... (7 Replies)
Discussion started by: Nishi_Licious
7 Replies

8. Shell Programming and Scripting

How to store results of multiple sql queries in shell variables in ksh?

Hi, I have a script where I make a sqlplus connection. In the script I have multiple sql queries within that sqlplus connection. I want the result of the queries to be stored in shell variables declared earlier. I dont want to use procedures. Is there anyway else. Thanks in advance.. Cheers (6 Replies)
Discussion started by: gonchusirsa
6 Replies

9. Linux

How to store count of multiple queries in variables in a shell script?

how to store the count of queries in variables inside a filein shell script my output : filename ------- variable1=result from 1st query variable2=result from 2nd query . . . . (3 Replies)
Discussion started by: sanvel
3 Replies

10. Shell Programming and Scripting

Store output in variables instead of files

Hi All, I have written a (bash) function which generates multiple files say file1 file2 file3 now I want to reduce the generation of these three files i.e. store the output of three files in variables, and generate the same results, in-order to avoid multiple creation of files how is that... (7 Replies)
Discussion started by: sam@sam
7 Replies
lassign(n)						       Tcl Built-In Commands							lassign(n)

__________________________________________________________________________________________________________________________________________________

NAME
lassign - Assign list elements to variables SYNOPSIS
lassign list varName ?varName ...? _________________________________________________________________ DESCRIPTION
This command treats the value list as a list and assigns successive elements from that list to the variables given by the varName arguments in order. If there are more variable names than list elements, the remaining variables are set to the empty string. If there are more list elements than variables, a list of unassigned elements is returned. EXAMPLES
An illustration of how multiple assignment works, and what happens when there are either too few or too many elements. lassign {a b c} x y z ;# Empty return puts $x ;# Prints "a" puts $y ;# Prints "b" puts $z ;# Prints "c" lassign {d e} x y z ;# Empty return puts $x ;# Prints "d" puts $y ;# Prints "e" puts $z ;# Prints "" lassign {f g h i} x y ;# Returns "h i" puts $x ;# Prints "f" puts $y ;# Prints "g" The lassign command has other uses. It can be used to create the analogue of the "shift" command in many shell languages like this: set ::argv [lassign $::argv argumentToReadOff] SEE ALSO
lindex(n), list(n), lset(n), set(n) KEYWORDS
assign, element, list, multiple, set, variable Tcl 8.5 lassign(n)
All times are GMT -4. The time now is 03:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy