Results 1 to 4 of 4

Thread: BASH: Text string variable with spaces

  1. #1
    Join Date
    May 2007
    Location
    Canada!
    Beans
    1,709
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    BASH: Text string variable with spaces

    I'm quite confused with this. This
    Code:
    #!/bin/bash
    variable="Hello there!"
    echo $variable
    makes the variable return "Hello there!", like it should, but in this code
    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!?!?!

  2. #2
    Join Date
    Jun 2006
    Location
    Neither here nor there
    Beans
    3,290
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: BASH: Text string variable with spaces

    for me:

    Code:
    #!/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?
    Linux & MythTV 4 Life
    Running ubuntu on an Atom 330, Atom D525, Turion 64 X2 TL-56, X2 3800, X2 4200, X2 4600, E2180, Core i5 450M, and a Core i7-2600
    My Hardware

  3. #3
    Join Date
    May 2007
    Location
    Canada!
    Beans
    1,709
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: BASH: Text string variable with spaces

    Well, here's the whole script:

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

    In theory, it should work, shouldn't it?!!
    Last edited by ryanVickers; September 29th, 2007 at 04:51 PM.

  4. #4
    Join Date
    May 2007
    Location
    Canada!
    Beans
    1,709
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: BASH: Text string variable with spaces

    I've done a little more testing, and found it's a zenity problem rather than BASH.
    Last edited by ryanVickers; September 29th, 2007 at 04:52 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •