PDA

View Full Version : BASH: Text string variable with spaces



ryanVickers
September 29th, 2007, 03:56 PM
I'm quite confused with this. This


#!/bin/bash
variable="Hello there!"
echo $variable

makes the variable return "Hello there!", like it should, but in this code


showopt=", "$showopt"Test Archive"

(showopt is blank at this point)
it seems to return "," meaning it ignored everything after the space. How might I fix this!?!?!:confused:

newlinux
September 29th, 2007, 04:15 PM
for me:


#!/bin/bash
showopt=", "$showopt"Test Archive"
echo $showopt


returns:

, Test Archive

Are you sure it is only returning ", "? Is there anything else in your script that might affect this?

ryanVickers
September 29th, 2007, 04:16 PM
Well, here's the whole script:

*I'm sorry, please see the main page (signature)*

In theory, it should work, shouldn't it?!!

ryanVickers
September 29th, 2007, 04:26 PM
I've done a little more testing, and found it's a zenity problem rather than BASH.