[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parse error in CASE .. ESAC
From: |
Chris F.A. Johnson |
Subject: |
Re: parse error in CASE .. ESAC |
Date: |
Wed, 09 Jan 2002 23:49:33 GMT |
On 9 Jan 2002 stig@hackvan.com wrote:
[snip]
> ipcomp() {
> : 'ipcomp <ipaddr> <bits> -- compute netmask, etc for ip address'
> ipaddr=$1
> ipbits=${2-24}
> case "$ipbits" in
> 24 ) ipmask=255.255.255.0 ;;
> 26 ) ipmask=255.255.255.192 ;;
> 27 ) ipmask=255.255.255.224 ;;
> 28 ) ipmask=255.255.255.240 ;;
> 29 ) ipmask=255.255.255.248 ;;
> 32 ) ipmask=255.255.255.255 ;;
> 255.* } ipmask=$ipbits ;;
255.* ) ipmask=$ipbits ;;
> * ) echo 'please specify netmask as nnn.nnn.nnn.nnn' ; exit 1 ;;
> esac
> ipnet=`ipcalc -n $ipaddr $ipmask | sed 's/.*=//'`
> echo "
> ;
> ; $ipaddr -- $ipnet/$ipbits
> ;
> BOOTPROTO=static
> BROADCAST=`ipcalc -b $ipaddr $ipmask | sed 's/.*=//`
> NETWORK=$ipnet
> ONBOOT=yes
> TYPE=Ethernet
> USERCTL=no
> PEERDNS=yes
> IPADDR=$ipaddr
> NETMASK=$ipmask
> "
> }
>
> YIELDS
>
> -- /etc/sysconfig/network-scripts > ipcomp() {
> > : 'ipcomp <ipaddr> <bits> -- compute netmask, etc for ip address'
> > ipaddr=$1
> > ipbits=${2-24}
> > case "$ipbits" in
> > 24 ) ipmask=255.255.255.0 ;;
> > 26 ) ipmask=255.255.255.192 ;;
> > 27 ) ipmask=255.255.255.224 ;;
> > 28 ) ipmask=255.255.255.240 ;;
> > 29 ) ipmask=255.255.255.248 ;;
> > 32 ) ipmask=255.255.255.255 ;;
> > 255.* } ipmask=$ipbits ;;
> bash: syntax error near unexpected token `}'
The error message is there for a purpose: it tells you what you did
wrong.
--
Chris F.A. Johnson bq933@torfree.net
=================================================================
c.f.a.johnson@rogers.com http://cfaj.freeshell.org
cfaj@freeshell.org http://members.rogers.com/c.f.a.johnson