[bash] redirect (save) array to a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [bash] redirect (save) array to a file
# 8  
Old 10-29-2009
Quote:
Originally Posted by ASGR
After weeks of searching the net and examining tens of
solutions, I do believe that the entire approach to arrays
in bash has been redefined due to your expertise and opened
up new possibilities for myself and other users. Dare I say
that it's even worthy of a third book!

There's a section in Chapter 13 of Pro Bash Programming, Two-Dimensional Grids, that deals with array manipulation.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Unset array element and save to file in Bash

#!/bin/bash X=(2H 4S 10D QC JD 9H 8S) How do I unset the 10D from this array and save it to a file? Please use CODE tags as required by forum rules! (5 Replies)
Discussion started by: cogiz
5 Replies

2. Shell Programming and Scripting

Bash to select and save file in new directory

I am trying to select a file in bash and save it to a directory. The below does run but no selected file is saved. Thank you :). bash # select file printf "please select a file to analyze with entered gene or genes \n" select file in $(cd... (4 Replies)
Discussion started by: cmccabe
4 Replies

3. Shell Programming and Scripting

Bash script - add/edit to file and save - sed?

I'm working on a script to execute a number of items. One being, editing particular files to add certain lines. I'm attempting to utilize sed, but, having issues when running from a bash script. Assistance is greatly appreciated. My example: sed -i '14 i\ # add these lines add these lines to... (5 Replies)
Discussion started by: Nvizn
5 Replies

4. Homework & Coursework Questions

Save output into file bash scripting

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: Hi there. i have created a program that in the end it will give output like this 1 2 3 4 5 10 9 ... (1 Reply)
Discussion started by: shdin271
1 Replies

5. Shell Programming and Scripting

Save output into file bash scripting

Hi there. i have created a program that in the end it will give output like this 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 .............. 17 i wonder how to save the output into a single string and into a file. i.e 1 10 11 12 9 2 3 8 13 14 7 4 5 6 15 17 (in this order,... (3 Replies)
Discussion started by: shdin271
3 Replies

6. UNIX for Dummies Questions & Answers

Passing values from file into array in Bash

Hi, I'm trying to write a bash script that takes a file and passes each line from the file into an array with elements separated by column. For example: Sample file "file1.txt": 1 name1 a first 2 name2 b second 3 name3 c third and have arrays such as: line1 = ( "1" "name1" "a"... (3 Replies)
Discussion started by: ShiGua
3 Replies

7. Shell Programming and Scripting

redirect time command output to file (cygwin bash)

I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like, echo "Runtimes for servlet 4, 100K structures" > test_times.txt echo "" >> test_times.txt echo "runs where N=10" >> test_times.txt echo... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

8. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

9. Shell Programming and Scripting

perl-data from file save to multidimensional array

i have a file,like 1 3 4 5 6 7 8 9 i want to save it into an array. and then i want to get every element, because i want to use them to calculate. for example: i want to calculate 1 + 3. but i cannot reach my goal. open (FILE, "<", "number"); my @arr; while (<FILE>){ chomp;... (1 Reply)
Discussion started by: pp-zz
1 Replies
Login or Register to Ask a Question
IMAGEPSBBOX(3)								 1							    IMAGEPSBBOX(3)

imagepsbbox - Give the bounding box of a text rectangle using PostScript Type1 fonts

SYNOPSIS
array imagepsbbox (string $text, resource $font, int $size) DESCRIPTION
array imagepsbbox (string $text, resource $font, int $size, int $space, int $tightness, float $angle) Gives the bounding box of a text rectangle using PostScript Type1 fonts. The bounding box is calculated using information available from character metrics, and unfortunately tends to differ slightly from the results achieved by actually rasterizing the text. If the angle is 0 degrees, you can expect the text to need 1 pixel more to every direc- tion. PARAMETERS
o $text - The text to be written. o $font_index - A font resource, returned by imagepsloadfont(3). o $size -$size is expressed in pixels. o $space - Allows you to change the default value of a space in a font. This amount is added to the normal value and can also be negative. Expressed in character space units, where 1 unit is 1/1000th of an em-square. o $tightness -$tightness allows you to control the amount of white space between characters. This amount is added to the normal character width and can also be negative. Expressed in character space units, where 1 unit is 1/1000th of an em-square. o $angle -$angle is in degrees. RETURN VALUES
Returns an array containing the following elements: +--+--------------------+ |0 | | | | | | | left x-coordinate | | | | |1 | | | | | | | upper y-coordinate | | | | |2 | | | | | | | right x-coordinate | | | | |3 | | | | | | | lower y-coordinate | | | | +--+--------------------+ EXAMPLES
Example #1 imagepsbbox(3) usage <?php // Create image handle $im = imagecreatetruecolor(200, 200); // Allocate colors $black = imagecolorallocate($im, 0, 0, 0); $white = imagecolorallocate($im, 255, 255, 255); // Load the PostScript Font $font = imagepsloadfont('font.pfm'); // Make a bounding box for the font $bbox = imagepsbbox('Sample text is simple', $font, 12); // Define our X and Y cordinates $x = ($bbox[2] / 2) - 10; $y = ($bbox[3] / 2) - 10; // Write the font to the image imagepstext($im, 'Sample text is simple', $font, 12, $black, $white, $x, $y); // Output and free memory header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 7.0.0 | | | | | | | T1Lib support was removed from PHP, thrus remov- | | | ing this function. | | | | +--------+---------------------------------------------------+ NOTES
Note This function is only available if PHP is compiled using --with-t1lib[=DIR]. SEE ALSO
imagepstext(3). PHP Documentation Group IMAGEPSBBOX(3)