Re: Bash script problem [OT?]

2012-04-25 Thread Cam Hutchison
Chris Davies chris-use...@roaima.co.uk writes: Cam Hutchison c...@xdna.net wrote: BK_LIST=() Append to the array with += BK_LIST+=${PARAM} This += syntax appears not to work with my version of bash (4.1.5(1)-release from package bash 4.1-3). Instead I have to do this: BK_LIST+=(${PARAM})

Re: Bash script problem [OT?]

2012-04-25 Thread Chris Davies
Cam Hutchison c...@xdna.net wrote: Sigh. Sorry, it was a typo. That explains why it did not work for the OP. Phew! These array things are new to me in a shell context - I've used associative and indexed arrays for years in awk and perl, though - and after your example didn't work I went digging

Re: Bash script problem [OT?]

2012-04-24 Thread Chris Davies
Cam Hutchison c...@xdna.net wrote: BK_LIST=() Append to the array with += BK_LIST+=${PARAM} This += syntax appears not to work with my version of bash (4.1.5(1)-release from package bash 4.1-3). Instead I have to do this: BK_LIST+=(${PARAM}) Was yours a typo, or is it something that now

Re: Bash script problem [OT?]

2012-04-23 Thread Iuri Guilherme dos Santos Martins
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

Re: Bash script problem [OT?]

2012-04-23 Thread Dan B.
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

Re: Bash script problem [OT?]

2012-04-23 Thread Cam Hutchison
Soare Catalin lolinux.so...@gmail.com writes: Thank you everyone for replying, but unfortunately, nothing seems to work for the moment, although all the answers appear to make sense. First, the array solution appears to work, but when tar gets all the parameters, they become a long string without

Re: Bash script problem [OT?]

2012-04-23 Thread Dan B.
I wrote: ... FILES_LIST=( ${FILES_LIST[@]} ${NEW_FILE} ) You can also write: FILE_LIST[${#FILE_LIST[@]}]=${NEW_FILE} Daniel -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive:

Re: Bash script problem [OT?]

2012-04-22 Thread Cam Hutchison
Soare Catalin lolinux.so...@gmail.com writes: The script will take files or dirs as parameters and will back them up in a presefined location, using tar. Problems arise when it will encounter files or directories which contain spaces in their names. then #is it an existing directory?

Re: Bash script problem [OT?]

2012-04-22 Thread Dom
On 22/04/12 08:34, Cam Hutchison wrote: Soare Catalinlolinux.so...@gmail.com writes: The script will take files or dirs as parameters and will back them up in a presefined location, using tar. Problems arise when it will encounter files or directories which contain spaces in their names.

Re: Bash script problem [OT?]

2012-04-22 Thread Soare Catalin
On Sun, Apr 22, 2012 at 10:25 PM, Dom to...@rpdom.net wrote: On 22/04/12 08:34, Cam Hutchison wrote: Soare Catalinlolinux.soare@gmail.**com lolinux.so...@gmail.com writes: The script will take files or dirs as parameters and will back them up in a presefined location, using tar.

Re: Bash script problem [OT?]

2012-04-22 Thread Dom
On 22/04/12 22:02, Soare Catalin wrote: On Sun, Apr 22, 2012 at 10:25 PM, Domto...@rpdom.net wrote: On 22/04/12 08:34, Cam Hutchison wrote: Soare Catalinlolinux.soare@gmail.**comlolinux.so...@gmail.com writes: The script will take files or dirs as parameters and will back them up in a

Bash script problem [OT?]

2012-04-21 Thread Soare Catalin
Hello fellow Linux supporters! I apologise if this specific thread is off topic to this mailing list. I've been having problems with a backup script and am not sure how to make this work. So far, Mr. Google hasn't helped me much -- maybe my search terms have been as dumb as I'm feeling right

Re: Bash script problem [OT?]

2012-04-21 Thread emmanuel segura
BK_FULLPATH=${BK_LOCATION}/BACKUP_${DATETIME}.tar.bz2 tar -cjf $BK_FULLPATH $BK_LIST Il giorno 21 aprile 2012 10:07, Soare Catalin lolinux.so...@gmail.com ha scritto: Hello fellow Linux supporters! I apologise if this specific thread is off topic to this mailing list. I've been having

Re: Bash script problem [OT?]

2012-04-21 Thread emmanuel segura
Scusa ho svagliato BK_FULLPATH=${BK_LOCATION}BACKUP_${DATETIME}.tar.bz2 tar -cjf $BK_FULLPATH $BK_LIST Il giorno 21 aprile 2012 10:07, Soare Catalin lolinux.so...@gmail.com ha scritto: Hello fellow Linux supporters! I apologise if this specific thread is off topic to this mailing list.