Escaping quote marks

Ray Parrish crp at cmc.net
Fri Nov 20 12:24:36 UTC 2009


Hello,

I have the following code which I would like to improve.

    URLs=""
     while read ThisLine; do
           case "$ThisLine" in
                *\<loc\>*) # if line starts with <loc> concatenate it 
into string variable URLs.
                         URLs="$URLs $ThisLine";;
           esac
     done < "$MapName"
     # Prompt user with drop down list of urls to select one to remove 
from site map.
     SelectedLine=`Xdialog --stdout --title "Add URL to Site Map - 
Remove URL" --combobox "Select web page to remove from site map" 10 70 
$URLs`

The problem is that if any of the iines starting with <loc> contain 
spaces in their file names, the combobox presents them broken up at the 
spaces on separate lines in it's drop down list.

I have tried to escape quote marks wrapped around each $ThisLine 
concatenated to the URLs string variable as below to make them 
individual parameters, but when I do this the quote marks get written to 
the drop down list, and the entries are still broken at each space.

                         URLs="$URLs \"$ThisLine\"";;

Is there any way to get the code to work correctly so it does not break 
the urls on space characters?

Thanks for any help you can be.

Later, Ray Parrish

-- 
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com






More information about the ubuntu-users mailing list