Script to add line to ipfw.conf file

I need to find a way to add a line to the /usr/local/etc/ipfw.conf file.

What I thought would be an easy script is giving me headaches and I am hoping one of you can point me in the right direction?

This is what I want it to do:

cd /usr/local/etc/
sudo vi ipfw.conf
i
add 00050 allow udp from any to any src-port 67 dist-port 68 in
esc
:wq

This is the script I've written.....

do shell script "cd /usr/local/etc/; vi ipfw.conf; i; 'add 00050 allow udp from any to any src-port 67 dist-port 68 in'; ^V ESC; :wq" with administrator privileges

It seems to be hanging on the ^V ESC

Would there be a better way to accomplish this task?


Mac_GoddessAsked:
Who is Participating?
 
Paolo SantiangeliConsulente InformaticoCommented:
hi,
did you try this:

do shell script "echo 'add 00050 allow udp from any to any src-port 67 dist-port 68 in' >> /usr/local/etc/ipfw.conf

Open in new window

0
 
Mac_GoddessAuthor Commented:
Thank you for helping me!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.