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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Array inside an array manas_ranjan UNIX for Advanced & Expert Users 5 06-10-2008 11:25 AM
array ccp Shell Programming and Scripting 3 02-26-2008 12:19 AM
I need help with an array! djsal Shell Programming and Scripting 1 11-28-2007 08:26 AM
create array holding characters from sring then echo array. rorey_breaker Shell Programming and Scripting 5 09-28-2007 05:42 AM
Do I need an array here? TheCrunge Shell Programming and Scripting 5 04-19-2005 12:20 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-31-2005
Registered User
 

Join Date: Aug 2005
Posts: 6
using array

how can i list and store all the results into an array?
say for example listing of file names and storing them individually into an array.
Reply With Quote
Forum Sponsor
  #2  
Old 08-31-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Code:
#!/bin/ksh

set -A filesA $(find . -type f 2>/dev/null)

typeset -i i=0
while (( $i < ${#filesA[*]} ))
do
    echo "index->[${i}] value->[${filesA[$i]}]"
    ((i+=1))
done
Reply With Quote
  #3  
Old 09-03-2005
Registered User
 

Join Date: Aug 2005
Posts: 6
apologies, but i am running under the bourne shell
Reply With Quote
  #4  
Old 09-05-2005
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,262
There is no array datatype in Bourne shell. Change to something more recent.

bakunin
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0