Escaping quote marks
ubuntu at swhi.net
Fri Nov 20 14:24:35 UTC 2009
Ray Parrish wrote:
> I have the following code which I would like to improve.
> while read ThisLine; do
> case "$ThisLine" in
> *\<loc\>*) # if line starts with <loc> concatenate it
> into string variable URLs.
> URLs="$URLs $ThisLine";;
> 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
> 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
I'm not sure if this will work, but does escaping the space characters
have the desired effect?
i.e.: URLs="$URLs\ \"$ThisLine\"";;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
Q: What is the most annoying thing in e-mail?
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
More information about the ubuntu-users