Enchantment
02-23-2001, 02:20 PM
I'm still learning the basics of shell scripting so bear with me. I'm trying to create a simple shell script that accepts one input and writes a couple of lines out to my firewall.blocked file. Here's what I have so far.
#!/bin/sh
<stuff>
echo "# Blocked" >> $BLOCKFILE
echo "$IPCHAINS -A input -s $1 -d $MACHINENET -j DENY" >> $BLOCKFILE
<stuff>
This does create the desired information in the file, but not in the format that I want. I would like to see the following in the file
if I call it with 1.1.1.1 as the parm.
# Blocked
$IPCHAINS -A input -s 1.1.1.1 -d $MACHINENET -j DENY
The firewall script knows how to resolve the variables $IPCHAINS and $MACHINENET. I've tried various combinations of " ' and ` but I haven't found the right combo. What should my line of code look like?
Thanks
#!/bin/sh
<stuff>
echo "# Blocked" >> $BLOCKFILE
echo "$IPCHAINS -A input -s $1 -d $MACHINENET -j DENY" >> $BLOCKFILE
<stuff>
This does create the desired information in the file, but not in the format that I want. I would like to see the following in the file
if I call it with 1.1.1.1 as the parm.
# Blocked
$IPCHAINS -A input -s 1.1.1.1 -d $MACHINENET -j DENY
The firewall script knows how to resolve the variables $IPCHAINS and $MACHINENET. I've tried various combinations of " ' and ` but I haven't found the right combo. What should my line of code look like?
Thanks