Find the answer to your Linux question:
Results 1 to 3 of 3
I am creating a script to configure dhcp and I am just getting one problem. I want to pass Domain name as "myscript.com" but in dhcpd.conf I am only getting ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    22

    Question problem in shell script for dhcp


    I am creating a script to configure dhcp and I am just getting one problem. I want to pass Domain name as "myscript.com" but in dhcpd.conf I am only getting myscript.com with out quotes. I am also mentioning my coding for the same

    echo "Enter Domain name: "
    read $dname

    echo " option domain-name "$dname"; >> /etc/dhcp/dhcpd.conf

    Output

    option domain-name myscript.com;

    However I want this myscript.com in double quotes

    Can any one please tell me what I am doing wrong

  2. #2
    Just Joined!
    Join Date
    May 2011
    Location
    Central FL
    Posts
    91
    Just escape the double-quotes in echo:
    Code:
    echo -n "Enter Domain Name: "
    read $dname
    echo "option domain-name \"$dname\" "; >> /etc/dhcp/dhcpd.conf
    The above works with GNU /bin/echo. Pending what shell you are using it may try to use the builtin echo, which may or may not play happily.

  3. #3
    Just Joined!
    Join Date
    Sep 2011
    Posts
    22
    @dayid
    Thanks man it worked for me, Thanks for your support

  4. $spacer_open
    $spacer_close

Posting Permissions

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