File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,12 +179,13 @@ func (c *converter) ElseEnd() error {
179179}
180180
181181func (c * converter ) ForStart () error {
182+ c .addLine (fmt .Sprintf (`%s=` , c .mustCurrentForVar ()))
182183 c .addLine ("while true; do" )
183184 return nil
184185}
185186
186187func (c * converter ) ForIncrementStart () error {
187- c .addLine (fmt .Sprintf (`if [ ! -z ${%s+x } ]; then` , c .mustCurrentForVar ())) // https://stackoverflow.com/a/13864829
188+ c .addLine (fmt .Sprintf (`if [ ! -z ${%s} ]; then` , c .mustCurrentForVar ())) // https://stackoverflow.com/a/13864829
188189 return nil
189190}
190191
Original file line number Diff line number Diff line change @@ -350,6 +350,7 @@ func (c *converter) ForStart() error {
350350 c .fors = append (c .fors , forInfo {
351351 label : label ,
352352 })
353+ c .addLine (fmt .Sprintf (`set "%s="` , c .mustCurrentForVar ()))
353354 c .addLine (label )
354355 return nil
355356}
You can’t perform that action at this time.
0 commit comments