Re: my lame attempt at a shell script...

2005-01-07 Thread Tom Vilot
Eric F Crist wrote: What is the point of the { } around some variables? It's not strictly necessary, except in some cases. i.e: m=34 echo $m You don't need it there. But you would want it here: f=/var/filename fname=${f//name/name2} It's when you need to differentiate the variable name from

Re: my lame attempt at a shell script...

2005-01-07 Thread Giorgos Keramidas
On 2005-01-07 09:36, Tom Vilot [EMAIL PROTECTED] wrote: Eric F Crist wrote: What is the point of the { } around some variables? It's not strictly necessary, except in some cases. i.e: m=34 echo $m You don't need it there. But you would want it here: f=/var/filename

Re: my lame attempt at a shell script...

2005-01-06 Thread Eric F Crist
Ok all. First off, thanks again for all the help you've offered thus far. That being said, I'm having a problem with variables in a function. The code I'm having a problem with is: setup_loopback () { ${fwcmd} add ${rulenum1} pass all from any to any via lo0; ${rulenum1}=`expr

Re: my lame attempt at a shell script...

2005-01-06 Thread Tom Vilot
Eric F Crist wrote: First off, thanks again for all the help you've offered thus far. That being said, I'm having a problem with variables in a function. The code I'm having a problem with is: setup_loopback () { ${fwcmd} add ${rulenum1} pass all from any to any via lo0;

Re: my lame attempt at a shell script...

2005-01-06 Thread Eric F Crist
On Jan 6, 2005, at 7:28 PM, Tom Vilot wrote: Eric F Crist wrote: First off, thanks again for all the help you've offered thus far. That being said, I'm having a problem with variables in a function. The code I'm having a problem with is: setup_loopback () { ${fwcmd} add ${rulenum1}

Re: my lame attempt at a shell script...

2005-01-06 Thread Tom Vilot
Eric F Crist wrote: What is the point of the { } around some variables? It's not strictly necessary, except in some cases. i.e: m=34 echo $m You don't need it there. But you would want it here: f=/var/filename fname=${f//name/name2} It's when you need to differentiate the variable name from

Re: my lame attempt at a shell script...

2005-01-06 Thread Timothy Luoma
On Jan 6, 2005, at 11:00 PM, Tom Vilot wrote: Eric F Crist wrote: What is the point of the { } around some variables? It's not strictly necessary, except in some cases. i.e: m=34 echo $m You don't need it there. But you would want it here: f=/var/filename fname=${f//name/name2} It's when you need

Re: my lame attempt at a shell script...

2005-01-04 Thread Erik Norgaard
Eric F Crist wrote: Sorry for the double reply, but I forgot to respond to the top half of this email. By including /etc/rc.subr, what exactly do I gain? There are already built-in means to execute a custom firewall script: I would assume that the system would institute my firewall rules at

Re: my lame attempt at a shell script...

2005-01-04 Thread Colin J. Raven
On Jan 3 at 13:44, Timothy Luoma launched this into the bitstream: On Jan 3, 2005, at 1:19 PM, Eric F Crist wrote: I'm trying to create a shell script for firewalling. What I'm hoping to do is create a generic script that looks for variables in /etc/rc.conf. I've tried looking at other scripts

Re: my lame attempt at a shell script...

2005-01-04 Thread Daniel Bye
On Mon, Jan 03, 2005 at 05:28:56PM -0600, Eric F Crist wrote: A couple more questions, then I'm done. Promise. I need to verify whether or not there is an entry for grog_firewall_oif and grog_firewall_iif in /etc/rc.conf. If not, I want to exit with an error. Read /etc/rc.conf into your

my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
Hello all, I'm trying to create a shell script for firewalling. What I'm hoping to do is create a generic script that looks for variables in /etc/rc.conf. I've tried looking at other scripts that use variables placed there, but don't understand how to pull the information from the file.

Re: my lame attempt at a shell script...

2005-01-03 Thread Hexren
EFC Hello all, EFC I'm trying to create a shell script for firewalling. What I'm hoping EFC to do is create a generic script that looks for variables in EFC /etc/rc.conf. I've tried looking at other scripts that use variables EFC placed there, but don't understand how to pull the information

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 1:19 PM, Eric F Crist wrote: I'm trying to create a shell script for firewalling. What I'm hoping to do is create a generic script that looks for variables in /etc/rc.conf. I've tried looking at other scripts that use variables placed there, but don't understand how to pull

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 12:44 PM, Timothy Luoma wrote: On Jan 3, 2005, at 1:19 PM, Eric F Crist wrote: I'm trying to create a shell script for firewalling. What I'm hoping to do is create a generic script that looks for variables in /etc/rc.conf. I've tried looking at other scripts that use

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 1:38 PM, Hexren wrote: I am not that great at bash but look in /etc/rc.firewall for the line where it says: . /etc/defaults/rc.conf I think this line includes /etc/rc.conf into the running script and as code in rc.conf is evaluated at the time it is included, all the variables

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 2:30 PM, Timothy Luoma wrote: On Jan 3, 2005, at 1:38 PM, Hexren wrote: I am not that great at bash but look in /etc/rc.firewall for the line where it says: . /etc/defaults/rc.conf I think this line includes /etc/rc.conf into the running script and as code in rc.conf is

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
[Eric: sorry if you see this twice. Resending online. hit REPLY instead of REPLY ALL by accident] On Jan 3, 2005, at 3:49 PM, Eric F Crist wrote: First off, let me thank you very much for the massive amount of information you've given me thus far. I am a commandline geek from way back, so

Re: my lame attempt at a shell script...

2005-01-03 Thread Erik Norgaard
Eric F Crist wrote: elif [ $grog_firewall_enable YES or NO ] then echo Syntax error in /etc/rc.conf file. grog_firewall_enable must be YES or NO fi I don't know if you're on 5.x, nor whether you use ipfw, ipfilter or pf - I wrote a replacement for ipfilter as I got dizzy trying to

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 4:27 PM, Eric F Crist wrote: Good to know. If I want to validate, like my first example, against some variables, how would I do that best. Say, for example, I have 4 possible entries for grog_firewall_enable but I want to single out three of them: if [ $grog_firewall_enable

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 3:34 PM, Erik Norgaard wrote: Eric F Crist wrote: elif [ $grog_firewall_enable YES or NO ] then echo Syntax error in /etc/rc.conf file. grog_firewall_enable must be YES or NO fi I don't know if you're on 5.x, nor whether you use ipfw, ipfilter or pf - I wrote a

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 4:34 PM, Erik Norgaard wrote: Eric F Crist wrote: elif [ $grog_firewall_enable YES or NO ] then echo Syntax error in /etc/rc.conf file. grog_firewall_enable must be YES or NO fi I don't know if you're on 5.x, nor whether you use ipfw, ipfilter or pf - I wrote a

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 3:34 PM, Erik Norgaard wrote: Eric F Crist wrote: elif [ $grog_firewall_enable YES or NO ] then echo Syntax error in /etc/rc.conf file. grog_firewall_enable must be YES or NO fi I don't know if you're on 5.x, nor whether you use ipfw, ipfilter or pf - I wrote a

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 4:52 PM, Eric F Crist wrote: In regards to the = or -eq, I can't discern a difference in output when I use them. Can you explain further their differences? I think they are different ways of saying the same thing. Personal preference only as to which is better. What would

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
I believe this is my last question. I need to do some math. Anyone familiar with ipfw knows that you can add a rule with: ipfw add [num] my firewall rule What I'm trying to do is have that number auto-computed. So, my command *should* look something like: $ipfwcmd add [rulenum1 + 50] my

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 4:16 PM, Timothy Luoma wrote: On Jan 3, 2005, at 4:52 PM, Eric F Crist wrote: In regards to the = or -eq, I can't discern a difference in output when I use them. Can you explain further their differences? I think they are different ways of saying the same thing. Personal

Re: my lame attempt at a shell script...

2005-01-03 Thread Paul Schmehl
--On Monday, January 03, 2005 04:21:41 PM -0600 Eric F Crist [EMAIL PROTECTED] wrote: I believe this is my last question. I need to do some math. Anyone familiar with ipfw knows that you can add a rule with: ipfw add [num] my firewall rule What I'm trying to do is have that number

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 4:40 PM, Paul Schmehl wrote: --On Monday, January 03, 2005 04:21:41 PM -0600 Eric F Crist [EMAIL PROTECTED] wrote: I believe this is my last question. I need to do some math. Anyone familiar with ipfw knows that you can add a rule with: ipfw add [num] my firewall rule What

Re: my lame attempt at a shell script...

2005-01-03 Thread Paul Schmehl
--On Monday, January 03, 2005 04:49:04 PM -0600 Eric F Crist [EMAIL PROTECTED] wrote: By on-the-fly, I meant by manually typing in a new rule on the command line. From there, I'd take the output of ipfw show and figure out where I want that rule placed. So, for the purposes of this script, I

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
A couple more questions, then I'm done. Promise. I need to verify whether or not there is an entry for grog_firewall_oif and grog_firewall_iif in /etc/rc.conf. If not, I want to exit with an error. Also, a little more advanced, I need to pull information from an ifconfig output. I need to

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 6:28 PM, Eric F Crist wrote: A couple more questions, then I'm done. Promise. I need to verify whether or not there is an entry for grog_firewall_oif and grog_firewall_iif in /etc/rc.conf. If not, I want to exit with an error. You want to check for either grog_firewall_oif or

Re: my lame attempt at a shell script...

2005-01-03 Thread Scott Bennett
On Mon, 3 Jan 2005 16:22:45 -0500 Timothy Luoma [EMAIL PROTECTED] wrote: On Jan 3, 2005, at 3:49 PM, Eric F Crist wrote: First off, let me thank you very much for the massive amount of information you've given me thus far. I am a commandline geek from way back, so you're welcome. My

Re: my lame attempt at a shell script...

2005-01-03 Thread Scott Bennett
On Mon, 3 Jan 2005 20:41:21 -0600 (CST) I wrote: On Mon, 3 Jan 2005 16:22:45 -0500 Timothy Luoma [EMAIL PROTECTED] wrote: On Jan 3, 2005, at 3:49 PM, Eric F Crist wrote: First off, let me thank you very much for the massive amount of information you've given me thus far. I am a

Re: my lame attempt at a shell script...

2005-01-03 Thread Eric F Crist
On Jan 3, 2005, at 8:21 PM, Timothy Luoma wrote: On Jan 3, 2005, at 6:28 PM, Eric F Crist wrote: A couple more questions, then I'm done. Promise. I need to verify whether or not there is an entry for grog_firewall_oif and grog_firewall_iif in /etc/rc.conf. If not, I want to exit with an error.

Re: my lame attempt at a shell script...

2005-01-03 Thread Timothy Luoma
On Jan 3, 2005, at 11:22 PM, Eric F Crist wrote: On Jan 3, 2005, at 8:21 PM, Timothy Luoma wrote: On Jan 3, 2005, at 6:28 PM, Eric F Crist wrote: A couple more questions, then I'm done. Promise. I need to verify whether or not there is an entry for grog_firewall_oif and grog_firewall_iif in