Sponsored Content
Full Discussion: Assigning values to an array
Top Forums UNIX for Dummies Questions & Answers Assigning values to an array Post 77913 by Perderabo on Wednesday 13th of July 2005 08:49:14 PM
Old 07-13-2005
Write a function:

Code:
$ cat loadr
#! /usr/bin/ksh
function loadr
{
        array[index]=$1
        ((index=index+1))
        return 0
}
index=0
loadr cat
loadr dog
loadr mouse

set | grep array
exit 0

$ ./loadr
array[0]=cat
array[1]=dog
array[2]=mouse
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl: Assigning array values..

I have to add a variable value to an array, something like this: ...... @my_array_name = $value_of_this_variable; This doesnt seem to work, any ideas why? Thanks! (4 Replies)
Discussion started by: looza
4 Replies

2. Shell Programming and Scripting

Assigning the values to an Array

hi every body, i donot know how to assign a array varible with a file see i having file more file property1 Name property2 Address the above two line are tab Space seperated between the property and its value i want to seperate it and assign to... (1 Reply)
Discussion started by: kkraja
1 Replies

3. Shell Programming and Scripting

Assigning values to an array via for/while loop

I need to do something like this: for i in 1 2 3 4 5; do arr=$(awk 'NR="$i" { print $2 }' file_with_5_records) done That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop. Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies

4. Shell Programming and Scripting

Assigning values for a dynamic array for an input

Hello, Can somebody please give me a snippet for the below requirement. I want to assign the values separeted by a comma to be assigned to a dynamic array. If I give an input (read statement) like abc1,abc2,abc3,abc4,abc5, all these strings abc* should be assigned to an array like below... (2 Replies)
Discussion started by: suneelj
2 Replies

5. Emergency UNIX and Linux Support

Assigning zero to element of ksh array.

set -A matched #find referenced files. for i in ${file_names_html} do counter_j=0 for j in ${file_names_minus_index} do match=`cat $i | grep... (1 Reply)
Discussion started by: robin_simple
1 Replies

6. Shell Programming and Scripting

Assigning array values using awk in shell scripting

hi My script as below #!/bin/ksh for i in `seq 1 7` do a=$(awk '{print $i}' /home/rama/expenese.txt) done for i in `seq 1 7` do echo "${a}" done content of expense.txt is as below 5032 210179 3110 132813874 53488966 11459221 5300794 I want output as... (6 Replies)
Discussion started by: Ramakrishna V
6 Replies

7. Shell Programming and Scripting

Assigning Column Values to ARRAY in ksh

Hi , i have file which is having two fields in it (#delimited) ABC#FILE_01.DAT DEF#FILE_02.DAT i want to write first field values to one array example A_01 and second field values to B_02 array please let me know how to do this ,my final requirement i have send out a mail for each record... (2 Replies)
Discussion started by: kkabc789
2 Replies

8. Shell Programming and Scripting

Perl : Assigning multile hash values to a single array

I know that @food = %fruit; Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies

9. Shell Programming and Scripting

Assigning * as value in a ksh array

I want to extract each and single character from a password string and put it in an array. I tried this : set -A password "echo $passwd | awk '{for (i=1; i<=length($1); i++) printf "%s ",substr($1,i,1)}'` It's working as long that the password string doesn't contains any * I tried a few... (5 Replies)
Discussion started by: ce9888
5 Replies

10. Shell Programming and Scripting

Assigning DOM Object value to an array

Hi, I have the following code that makes use of a URL that I store in a variable then create a document object below to work on it. $dom = new DOMDocument; @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); $links = $dom->getElementsByTagName('a'); ... (0 Replies)
Discussion started by: mojoman
0 Replies
ONEKO(6)							   Games Manual 							  ONEKO(6)

NAME oneko - Creates a cute cat chasing around your mouse cursor.
SYNOPSIS
oneko [-help] [-tora] [-dog] [-sakura] [-tomoyo] [-time n] [-speed n] [-idle n] [-name name] [-towindow] [-toname name] [-tofocus] [-posi- tion geometry] [-rv] [-noshape] [-fg] [-bg] DESCRIPTION
oneko changes your mouse cursor into mouse and creates a little cute cat and the cat start chasing around your mouse cursor. If the cat catchup the ``mouse'', start sleeping. Options -help Prints help message on usage. -tora Make cat into "tora-neko", a cat wite tiger-like stripe. -dog Runs a dog instead of a cat. -sakura Runs Sakura Kinomoto instead of a cat. -tomoyo Runs Tomoyo Daidouji instead of a cat. -time interval Sets interval timer which determine intervals for cat animation. Default value is 125000 and unit is micro-second. Smaller value makes cat run faster. -speed distance Specify the distance where cat jumps at one move in dot resolution. Default is 16. -idle speed Specify the threshold of the speed which ``mouse'' running away to wake cat up. -name name Specify the window name of cat. -towindow When oneko starts with this option, you must select a window by cursor. Then cat appears and starts chasing the window instead of mouse. You can select another running oneko as the target window. If root window is selected, cat chases mouse as usually. When the target window is not in sight and not closed, cat chases mouse as usually. If the target window is closed, this program exit. -toname name Specify the window name of target to make cat chase it instead of mouse. You can specify another running oneko as the target win- dow. When the target window is not in sight and not closed, cat chases mouse as usually. If the target window is closed, this pro- gram exit. -tofocus Makes cat run to and on top of focus window. When focus window is not in sight, cat chases mouse as usually. -position geometry Specify X and Y offsets in pixels to adjust position of cat relative to mouse pointer. -rv Reverse background color and foreground color. -noshape Don't use SHAPE extension. -fg color Foreground color. -bg color Background color. -cursor cursornumber Specify a cursos number to set when quitting. For example, 132 is the default root cursor. Resources Application name is "neko"(or "tora") and class name is "Oneko". tora Set ``True'' if you want "tora-neko". time Sets interval timer in micro-second. speed Sets distance to jump in pixel. idle Sets speed threshold to wake cat up when ``mouse'' running away. noshape Set ``True'' if you don't want to use SHAPE extension. reverse Set ``True'' if you want to switch foreground and background color. foreground Foreground color. background Background color. Notes While this program uses XGetDefault, be sure to use "neko.resouce" form. If you run this program as "tora", by hard of soft link, the -tora option is enabled by default. BSD Daemon Copyright 1988 by Marshall Kirk McKusick. All Rights Reserved. Sakura Kinomoto and Tomoyo Daidouji are characters in a comic strip "CARDCAPTOR SAKURA" (CLAMP, Kodansha), with the sanction indicated in CLAMP SCHOOL WEB CAMPUS (http://www.clamp.f-2.co.jp/). AUTHOR
Original xneko is written by Masayuki Koba and modified to oneko by Tatsuya Kato, and modified furthermore by John Lerchey, Eric Anderson, Toshihiro Kanda and Kiichiroh Mukose. MAINTAINER
Send questions or problems to mukose@hbar.mp.es.osaka-u.ac.jp ONEKO(6)
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy