String containing double quotes

String containing double quotes

Post by Keith Cockbur » Mon, 23 Jul 2001 00:04:52



I am trying to create a variable which is a list of directories to be backed
up using smbclient. Some of these directory names include a space so I need
to put " " around the name of the directory.

Is it possible to include " (double quotes) within this string. For example:

bkfiles="directory1 directory2 "My Documents" directory4"

Any help would be appreciated.

Keith

 
 
 

String containing double quotes

Post by Michael Heimin » Mon, 23 Jul 2001 03:32:13



> I am trying to create a variable which is a list of directories to be backed
> up using smbclient. Some of these directory names include a space so I need
> to put " " around the name of the directory.

> Is it possible to include " (double quotes) within this string. For example:

> bkfiles="directory1 directory2 "My Documents" directory4"

> Any help would be appreciated.

> Keith

'bkfiles="directory1 directory2 \"My Documents\" directory4"'
'echo $bkfiles'
directory1 directory2 "My Documents" directory4

looks like..:-)

Michael Heiming

 
 
 

String containing double quotes

Post by Leo Laurs » Mon, 23 Jul 2001 03:33:19


Sat, 21 Jul 2001 16:04:52 +0100, skrev Keith*burn

Quote:> I am trying to create a variable which is a list of directories to be backed
> up using smbclient. Some of these directory names include a space so I need
> to put " " around the name of the directory.
> Is it possible to include " (double quotes) within this string. For example:
> bkfiles="directory1 directory2 "My Documents" directory4"

I am new to this, so take it as a sugestion.
bkfiles="directory1 directory2 My\ Documents directory4"
or
bkfiles="directory1 directory2 \"My Documents\" directory4"

Leo
--
I may be getting older, but I refuse to grow up!
To err is human,
To purr feline.
                -- Robert Byrne

 
 
 

1. string containing double quotes

Many thanks to Michael Heiming for his prompt reply (as follows)

'bkfiles="directory1 directory2 \"My Documents\" directory4"'
'echo $bkfiles'
directory1 directory2 "My Documents" directory4

Although this works when I plug this into smbclient as follows -

smbclient //$user/c$ password -U username -Tc - $bkfiles | gzip > $opfile

smbclient correctly backs up directory1, directory2 and directory4 but also
attempts to back up the two directories "My and Documents".

If I type the following -

smbclient //$user/c$ password -U username -Tc - directory1 directory2 "My
Documents" directory4 | gzip > $opfile

all four directories (including My Documents) is backed up. Can anyone help.

Many thanks.

2. Virtual domains on FastStart

3. Q: sh: Can I quote '"' in a double quoted string?

4. Kernel Help Please.....

5. Double quotes within double quotes (no apostrophes)

6. rusage() under SMP

7. quoted strings within quoted strings

8. geforce2go + X = screen dead on shutdown

9. passing double-quoted string as C program arg

10. Sed question - prepend to double quoted strings

11. replace single quote to double quote with an example

12. Problem in sed using double quotes and single quotes

13. ? about single quote-double quote