bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: converting an array into a single variable


From: Mike Stroyan
Subject: Re: converting an array into a single variable
Date: Wed, 20 Feb 2008 18:03:09 -0700
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

On Wed, Feb 20, 2008 at 11:42:38AM -0800, Natan Shar wrote:
> 
> Here's what I am trying to do:
> 
> I have a directory full of files. They are all image files and are numbered
> using an id number, and underscore, and a detail number. Example:
> 
> for item 123456, there may be from 0 to 25 images with names such as
> '123456_0.JPG' or '123456_47.JPG'
> 
> I need to collect the names of these files and then convert it into one
> variable that I can then write into a database. My ideal example for the
> above would be'123456_0.JPG,123456_47.JPG'
a=(www/images/*);a=$(IFS=,; echo "${a[*]}";);a="${a//www\/images\/}";echo $a

-- 
Mike Stroyan <mike@stroyan.net>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]