I had round brackets rather than curly (the writing is on the wall - I
now need glasses) though that was not the only thing to fix. Eventually
i discovered through more googling that it is necessary to enclose my
declared value in quotes like this:

AQDS="/home/roger/smb4k/AQUARIUS/AquariusSystem/Documents and Settings" 
<--- no escaping required here

$Tar $TarFile \
"${AQDS}"/ashley/Desktop \
"${AQDS}"/ashley/Favorites \
etc

These altered lines result in success.  Thanks for the late night reply!


Nick Rout wrote:
> Its too late for this but...
>
> declare Ads as
>
> Ads="/home/roger/smb4k/AQUARIUS/AquariusSystem/Documents and Settings"
>
> or
>
> Ads=/home/roger/smb4k/AQUARIUS/AquariusSystem/Documents\ and\ Settings
>
> as far as joining to other text, play on the command line, but I
> suspect you will want:
>
> "$Ads/username/Desktop"
>
> Or
> ${Ads}/username/Destop
>
> unless username has spaces, in which case more quoting or escaping
> will be needed.
>
> The ${} makes sure that special characters in $Ads are treated properly.
>
> By the way, most bash script I see written has variables in UPPERCASE.
> Its not by any means needed, just a readability thing.
>
>
> Roger Searle wrote:
>> Can't think of a particularly good subject line here, sorry, hope my
>> questions are clear...
>>
>> Continuing on with my backup scripts, and wanting to back up some files
>> on a windows machine that family members use.  Quite a few of the
>> directories I want to back up are in the user profiles contained within
>> the "documents and settings" folder.  The mounted path to this windows
>> location from my linux box is
>> "/home/roger/smb4k/AQUARIUS/AquariusSystem/Documents and Settings".
>>
>> Given the spaces in that path, I thought I might declare this path in
>> the script:
>> Ads="c
>> and then I could tell tar to back up a folder based on this, but I don't
>> know how to add to this base path nor do I think I am declaring Ads
>> correctly given the spaces, and that the \ character is within quotes.
>> So the first question is:  how do I correctly declare Ads so that I can
>> use it as the basis for a path to tell tar to back up?
>>
>> The second question is, how do I correctly join Ads to
>> "/username/Desktop" for example?
>> $Ads/username/Desktop ?
>> $(Ads)/username/Desktop ?
>> Something else?
>>
>> Probably obviously, I am not a programmer, all I need though is to get
>> this general method sorted and I will be away...
>>
>> A simple form of the script I have so far is below, in case it helps
>> clarify what I am doing.  And to note... the last commented line in it
>> will (uncommented) successfully back up the /ashley/Desktop folder.
>> $Aqds/ashley/Desktop will not, it will return the error:
>> backup-aquarius.sh: line 9:
>> /home/roger/smb4k/AQUARIUS/AquariusSystem/Documents\: Invalid argument
>> (this is a reference to line 5 where I am trying to create Aqds
>>
>> #!/bin/bash
>>
>> TarFile=/home/roger/backup-aquarius-`date +%a-%d-%m-%y`.tgz
>> Tar="/bin/tar -czvf"
>> Aqds="/home/roger/smb4k/AQUARIUS/AquariusSystem/Documents\ and\
>> Settings"
>>
>> $Tar $TarFile \
>> #/home/roger/smb4k/AQUARIUS/AquariusSystem/Documents\ and\
>> Settings/ashley/Desktop
>> $Aqds/ashley/Desktop
>>
>> Cheers,
>> Roger
>>
>>
>>
>>   
>

Reply via email to