BASH Question - nested case statements
I'm not much of a scripter so I'm not sure if this simply can't be nested like this or if I have a syntax error. It is bombing at line 106 with "syntax error near unexpected token ')'
line 106 ` PROD-LOC2)'
case "$SYS_TYPE" in
97 PROD)
98 case "$SYS_ENV" in
99 PROD-LOC1)
100 case "$SYS_IP" in
101 172.168.120.*) sed -i -e "s/foo/bar/" /etc/hosts
102 sed -i -e "s/foo/bar/" /etc/hosts
103 ;;
104 esac
105
106 PROD-LOC2)
107 case "$SYS_IP" in
108 172.168.120.*) sed -i -e "s/foo/bar/" /etc/hosts
109 sed -i -e "s/1foo/bar/" /etc/hosts
110 ;;
111 esac
112 esac
113 TEST)
114 case "$SYS_ENV" in
115 TEST-LOC1)
116 case "$SYS_IP" in
117 172.168.120.*) sed -i -e "s/foo/bar/" /etc/hosts
118 sed -i -e "s/foo/bar/" /etc/hosts
119 ;;
120 esac
121 TEST-LOC2)
122 case "$SYS_IP" in
123 172.168.120.*) sed -i -e "s/foo/bar/" /etc/hosts
124 172.268.120.*) sed -i -e "s/foo/bar/" /etc/hosts
125 sed -i -e "s/foo/bar/" /etc/hosts
126 ;;
127 esac
128 ;;
129 esac
130 ;;
131 esac
doesn't like nesting case statements that deep?
Ugh.. the site takes out the formatting. Makes this kind of hard to read
Last edited by jbeiter; 02-13-2012 at 10:01 AM.
|