Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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 "" but in dhcpd.conf I am only getting 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


    option domain-name;

    However I want this in double quotes

    Can any one please tell me what I am doing wrong

  2. #2
    Just Joined!
    Join Date
    May 2011
    Austin, TX
    Just escape the double-quotes in echo:
    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
    Thanks man it worked for me, Thanks for your support

  4. $spacer_open

Posting Permissions

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