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

Re: Bash script problem [OT?]



Iuri Guilherme dos Santos Martins wrote:
When dealing with paths in bash i usually employ two things:

One is declaring arrays like this:

FILES_LIST=( )

And everytime I want to append to the array I go like this:

FILES_LIST=( ${FILES_LIST[@]} ${NEW_FILE} )

Obviously I will have problems if the paths or files have spaces in their names, ...

Does this work?

 FILES_LIST=( "${FILES_LIST[@]}" "${NEW_FILE}" )

(Read the part of the bash manual page that describes how ...[*]
and ...[@] act when inside double-quoted strings.)


Daniel


Reply to: