[sdnog] shell Script for DNS

Manhal Mohammed manhal_muhamed at hotmail.com
Mon Jan 11 10:52:07 SAST 2016


 thank you for your response :) 
i have tried all the possible ways in my mind to write the variable inside the string : #1 your suggestion :  echo enter your domainread new_domaincp ext.example.sd.zone  ext.${new_domain}.sd# result : ': not a valid identifierd: `new_domain----------------------------------------------------#2 cp ext.example.sd.zone  ext.'\${new_domain}'\.sd--------------------------------------------------#3 cp ext.example.sd.zone  {ext.$new_domain.sd}-------------------------------------------------# for all options the result is in the variable :/ :  ': not a valid identifierd: `new_domain











Hi,

Overall your concept looks ok.
###
cp ext.example.sd  ext.$new_domain.sd # this is not working :D 
###

In the above, how is it not working? That is, I think I understand what you want to happen. But can you give us all a little more details on what *does* happen in reality?

Without more info I can only guess, but one thing you may be running into is your shell misinterpreting where the variable stops and starts and what is part of the string that is not variable name.

If I got lucky and guessed right, then try this:

###
cp ext.example.sd  ext.${new_domain}.sd
###




-------- Original Message --------
Subject: [sdnog] shell Script for DNS
Local Time: January 11 2016 10:45 am
UTC Time: January 11 2016 6:45 am
From: manhal_muhamed at hotmail.com
To: sdnog at sdnog.sd

helloooo  Sdnoggers ^_^  

i have a question on shell scripting :) 
i'm trying to make a shell script to change  IPs ,  adding new domains on  DNS  and many other operations to make it easier for me :D 

on  "creating new domain" section of this script : 

 i have a zone file "ext.example.sd"witch i want to copy to the new domain which is a "variable"  
so : this is my idea of how this simple section of my script will be :

##########

echo ENTER YOUR DOMAIN : 
read new_domain 
cp ext.example.sd  ext.$new_domain.sd # this is not working :D 
 sed -i -e 's/20[0-9][0-9]\{6\}/2016011100/g' ext.$new_domain.sd  #to reset the serial num 

###########

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sdnog.sd/pipermail/sdnog/attachments/20160111/c51d0560/attachment.html>


More information about the sdnog mailing list