The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash array passed to oracle satnamx Shell Programming and Scripting 1 11-28-2008 12:37 PM
[BASH - KSH] Passing array to a function ripat Shell Programming and Scripting 3 04-17-2008 09:17 AM
bash:awk output into an array phamp008 Shell Programming and Scripting 2 03-16-2008 05:14 AM
bash array gubten Shell Programming and Scripting 1 12-08-2006 04:47 PM
How can i read array elements dynamically in bash? haisubbu UNIX for Dummies Questions & Answers 1 08-29-2006 03:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-19-2008
yagnesh yagnesh is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 1
bash array problem

hi friends.,
i have two files yy.dat and mm.dat containing 110 elements in each
if i read them into variables it is just showing only 4 elements instead of 110 elements

My script is like this
##################################
/bin/bash

declare -a yy=(`cat yy.dat`)
echo "No of values in yy array: ${#yy}"
yynum=${#yy}

declare -a MM=(`cat mm.dat`)
echo "No of values in MM array: ${#MM}"


for ((i=0;i<$yynum;i++)); do
date2jd ${MM[${i}]} ${yy[${i}]} >> ans.dat
echo >> ans.dat
done

echo "results written in ans.dat"
######################################

if i run this in command line

[yagnesh@aces00 sst]$ ./d2jd.sh
No of values in yy array: 4
No of values in MM array: 4
results written in ans.dat

in yy and MM arrays only four values are loaded..

any clues where i did wrong........

thanks in advance
  #2 (permalink)  
Old 08-19-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,407
what is $yynum??
try running script sh -x ./d2jdsh
you will find some clue..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0