Sponsored Content
Full Discussion: Arrays with UNIX Commands
Top Forums UNIX for Advanced & Expert Users Arrays with UNIX Commands Post 302952594 by shyamshankarj on Thursday 20th of August 2015 07:46:00 AM
Old 08-20-2015
Arrays with UNIX Commands

Hi,

Can anyone please guide me to pass the values for an array during runtime and use it.

I am using Linux OS.

what I am trying to do is, i am trying to pass the output of the ls <source folder> command to a array and copy the list of files in the array to a different (Destination) folder.

How to do the same.


Code:
#!/bin/sh
i=$(ls /home/e1013699/NewFiles/20150721/extracts | wc -l)
a=$(ls NewFiles/20150721/extracts)
echo ${a[@]}

Correct me if i am wrong

Thanks in Advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Maingrame to UNIX sending UNIX commands

I want to know if there is a way to send unix commands thru FTP from a mainframe to kick off Autosys Jobs. I just need to send a command from the mainframe to UNIX and have UNIX execute that command. (2 Replies)
Discussion started by: skammer
2 Replies

2. Shell Programming and Scripting

Passing arrays to oracle from unix

Hi all Iam trying to send an array to oracle procedure from unix. Iam writing a program in K Shell to pass this array to oracle. Is it possible. Please advice thanks Krishna (7 Replies)
Discussion started by: krishnasai
7 Replies

3. UNIX for Dummies Questions & Answers

are Associative Arrays possible in UNIX?

Is it possible to say.. myArr=34 myArr=15 ? (11 Replies)
Discussion started by: yongho
11 Replies

4. Shell Programming and Scripting

Passing arrays to oracle from unix

Hi all... Im looking to pass the contents of a simple file to Oracle so that it can be stored in a database table. The best way i can think of to avoid overhead is to loop through the contents of the file and store the data in a bash array. then the array can be passed to SQL Plus where... (4 Replies)
Discussion started by: satnamx
4 Replies

5. Shell Programming and Scripting

Arrays in unix

I have a Main shell script file. In that the below lines(7) is spooled in Oracle & written to a file say temp.out INSTANCE_N ---------- undefined PROACT1 REPCAT1 PROACT2 REPCAT2 I want to ignore the first 3 lines & put the rest 4 lines PROACT1..REPCAT2 into the arrays. So that i can use... (2 Replies)
Discussion started by: dreams5617
2 Replies

6. Shell Programming and Scripting

2d arrays in unix

hi everybody can anyone help me with usage of 2 dimensional arrays in unix. please provide a suitable example for accessing individual elements as well as all elements. Thanks (2 Replies)
Discussion started by: jpriyank
2 Replies

7. UNIX for Dummies Questions & Answers

Arrays in UNIX

Hi there, I have a small piece of code i=1 Number=10 while do echo "$i" Check=`cmd to give to me file name with path i=`expr ${i} + 1` done when i do in a loop echo "$Check"---------Unable to display, the values. ... (5 Replies)
Discussion started by: Naveen_5960
5 Replies

8. Shell Programming and Scripting

Parameters + arrays in unix shell

Say I have ./param HEY What would I do if I wanted to store each character into an array? Example. ARRAY1="H" ARRAY1="E" ARRAY1="Y" thank you! (5 Replies)
Discussion started by: puttster
5 Replies

9. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

10. UNIX for Dummies Questions & Answers

Arrays in unix

hi all, is there any method to declare each line of a text file to array variable. my text file is: 123 222 333 so, a=123 a=222 a=333 can anyone help me out pls... thanks in advance, Arun Manas:b: (4 Replies)
Discussion started by: arunmanas
4 Replies
CAIRO_SVG_SURFACE_GET_VERSIONS(3)					 1					 CAIRO_SVG_SURFACE_GET_VERSIONS(3)

CairoSvgSurface::getVersions - Used to retrieve a list of supported SVG versions

       Object oriented style (method):

SYNOPSIS
publicstatic array CairoSvgSurface::getVersions (void ) DESCRIPTION
Procedural style: array cairo_svg_get_versions (void ) Returns a numerically indexed array of currently available CairoSvgVersion constants. In order to retreive the string values for each item, use CairoSvgSurface::versionToString. PARAMETERS
This function has no parameters. RETURN VALUES
Returns a numerically indexed array of integer values. EXAMPLES
Example #1 CairoSvgSurface::getVersions example <?php /* Grab our list of versions */ $versions = CairoSvgSurface::getVersions(); var_dump($versions); /* echo the string name of each version */ foreach($versions as $id) { echo CairoSvgSurface::versionToString($id), PHP_EOL; } ?> The above example will output something similar to: array(2) { [0]=> int(0) [1]=> int(1) } SVG 1.1 SVG 1.2 Example #2 Procedural style <?php /* Grab our list of versions */ $versions = cairo_svg_surface_get_versions(); var_dump($versions); /* echo the string name of each version */ foreach($versions as $id) { echo cairo_svg_surface_version_to_string($id), PHP_EOL; } ?> The above example will output something similar to: array(2) { [0]=> int(0) [1]=> int(1) } SVG 1.1 SVG 1.2 SEE ALSO
CairoSvgSurface::versionToString. PHP Documentation Group CAIRO_SVG_SURFACE_GET_VERSIONS(3)
All times are GMT -4. The time now is 12:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy