Find the answer to your Linux question:
Results 1 to 5 of 5
Hello! I need some help with an echo statement. I am using "read variablenamehere" to get user input in an installer. That part works fine. I need to write that ...
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    8

    Echo Assistance Needed

    Hello!
    I need some help with an echo statement. I am using "read variablenamehere" to get user input in an installer. That part works fine. I need to write that to a file, though. This is the code I have now:

    (I was trying to post code here, but it picks up part of it as a URL. See
    Code:
    pastebin .com/ 8TmS3wG5
    Sorry for the spaces, I can't post URLs yet)

    Everything works great except for all of the variables on the left ($username, $password, etc) are not sent to the file. Rather they are parsed as variables and send blank text i.e. nothingness. How can I get echo to not parse the variables on the left, but parse the ones on the right?

    Thanks for your help!
    Ross

  2. #2
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Hi,

    Try escaping the dollar sign with a backslash, to prevent the shell (bash, etc.) from interpreting it for you, e.g.:
    Code:
    echo "\$username = 'gvsms'; " >>  config.inc.php

  3. #3
    Just Joined!
    Join Date
    May 2011
    Posts
    8
    Quote Originally Posted by atreyu View Post
    Hi,

    Try escaping the dollar sign with a backslash, to prevent the shell (bash, etc.) from interpreting it for you, e.g.:
    Code:
    echo "\$username = 'gvsms'; " >>  config.inc.php
    I think that is what I want to do, but I still want the other variables for $installdbpass, $gvemail, and $gvpass to be passed as their values. Will it work that way?

  4. #4
    Just Joined!
    Join Date
    May 2011
    Posts
    8
    Quote Originally Posted by RossIV View Post
    I think that is what I want to do, but I still want the other variables for $installdbpass, $gvemail, and $gvpass to be passed as their values. Will it work that way?
    YEAH!!!!!! It works! Thank you!!!!

  5. #5
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    cheers!!!!

Posting Permissions

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