Sponsored Content
Top Forums Shell Programming and Scripting Write filenames into an array variable Post 302629271 by amrutha0303 on Tuesday 24th of April 2012 12:38:03 PM
Old 04-24-2012
Corona,

I reran the scripts using bash shell and they were throwing the same errors at me.

I am still looking for some help trying to print the values stored in the array for the code below:

Code:
#!/bin/bash
cd $HOME/HY_DUMP
num=0
for filename in *.sql
do 
testarray[$num]=$filename
(( num += 1 ))
echo $num
done
testnum=$num
num=0
echo $testnum

Any help with this, i would highly appreciate.
-A
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Push records to array during implicit loop and write to file

NEWBIE ALERT! Hi, I'm 1 month into learning Perl and done reading "Minimal Perl" by Tim Maher (which I enjoyed enoumously). I'm not a programmer by profession but want to use Perl to automate various tasks at my job. I have a problem (obviously) and are looking for your much appreciated help.... (0 Replies)
Discussion started by: jospan
0 Replies

2. Shell Programming and Scripting

i have no understanding of how to write an array or use one, please help!

im in a basic unix class and our professor speaks broken engliash so i can never understand what exactly we are doing in class and i have no prior experience with unix. we were given an assignment to make 2 files. one to Input 10 numbers and print out the biggest number, and one to Write a script... (1 Reply)
Discussion started by: wendyshephard
1 Replies

3. Homework & Coursework Questions

i have no understanding of how to write an array or use one, please help!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: make 2 files. one to Input 10 numbers and print out the biggest number, and one to Write a script that can check... (1 Reply)
Discussion started by: wendyshephard
1 Replies

4. Shell Programming and Scripting

Storing cutted filenames into variable

Hi, I'd like to write a script which works on various files file1.jpg, file2.jpg ..... These files are splitted and their names are something like file_.XXX. I'd like to merge them and convert them at some moment again in file.XXX also file1_1.jpg file1_2.jpg ... >file1.pdf file2_1.txt... (2 Replies)
Discussion started by: bsco
2 Replies

5. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

6. Shell Programming and Scripting

Write array contents to file

Hi, I have a bash script that currently holds some data. I am trying to write all the contents to a file called temp.txt. I am using echo ${array} > temp.txt The problem that I am experiencing is that the elements are being written horizontally in the file. I want them written... (5 Replies)
Discussion started by: Filter500
5 Replies

7. Shell Programming and Scripting

How to get filenames in a directory and write them in to a file?

I need to get the names of files which are starting with a string testfile. Also i want to create a XML file in the same location and write these file names into the XML. Ex: <path> <dir> <file>testfile1</file> </dir> <dir> <file>testfile2</file> </dir>... (4 Replies)
Discussion started by: vel4ever
4 Replies

8. Shell Programming and Scripting

Storing filenames in an array in shell script

hi, i am writing a shell script in which i read a line in a variable. FNAME="s1.txt s2.txt s3.txt s4.txt s5.txt" i want to create a array and store single file names in a array.. so the array should contain arr="s1.txt" arr="s2.txt" arr="s3.txt" arr="s4.txt" arr="s5.txt" how to... (3 Replies)
Discussion started by: Little
3 Replies

9. Shell Programming and Scripting

Naming output files based on variable parameters and input filenames

Hello, I have a series of files in sub-directories that I want to loop through, process and name according to the input filename and the various parameters I'm using to process the files. I have a number of each, for example file names like AG005574, AG004788, AG003854 and parameter values like... (2 Replies)
Discussion started by: bdeads
2 Replies
postplot(1)							   User Commands						       postplot(1)

NAME
postplot - PostScript translator for plot(4B) graphics files SYNOPSIS
postplot [-c num] [-f name] [-m num] [-n num] [-o list] [-p mode] [-w num] [-x num] [-y num] [filename]... /usr/lib/lp/postscript/postplot DESCRIPTION
The postplot filter translates plot(1B) graphics filenames into PostScript and writes the results on the standard output. If no filenames are specified, or if - is one of the input filenames, the standard input is read. OPTIONS
The following options are supported: -c num Print num copies of each page. By default, only one copy is printed. -f name Print text using font name. Any PostScript font can be used, although the best results will be obtained only with constant width fonts. The default font is Courier. -m num Magnify each logical page by the factor num. Pages are scaled uniformly about the origin which, by default, is located at the center of each page. The default magnification is 1.0. -n num Print num logical pages on each piece of paper, where num can be any positive integer. By default, num is set to 1. -o list Print pages whose numbers are given in the comma-separated list. The list contains single numbers N and ranges N1 - N2. A miss- ing N1 means the lowest numbered page, a missing N2 means the highest. -p mode Print filenames in either portrait or landscape mode. Only the first character of mode is significant. The default mode is land- scape. -w num Set the line width used for graphics to num points, where a point is approximately 1/72 of an inch. By default, num is set to 0 points, which forces lines to be one pixel wide. -x num Translate the origin num inches along the positive x axis. The default coordinate system has the origin fixed at the center of the page, with positive x to the right and positive y up the page. Positive num moves everything right. The default offset is 0.0 inches. -y num Translate the origin num inches along the positive y axis. Positive num moves everything up the page. The default offset is 0.0. OPERANDS
The following operand is supported: filename The graphics filename to be translated EXIT STATUS
The following exit value is returned: 0 filename(s) were successfully processed. FILES
/usr/lib/lp/postscript/forms.ps /usr/lib/lp/postscript/postplot.ps /usr/lib/lp/postscript/ps.requests ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWlps | +-----------------------------+-----------------------------+ SEE ALSO
download(1), dpost(1), plot(1B), postdaisy(1), postdmd(1), postio(1), postmd(1), postprint(1), postreverse(1), plot(4B), attributes(5) NOTES
The default line width is too small for write-white print engines, such as the one used by the PS-2400. SunOS 5.11 17 Jun 1992 postplot(1)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy