On Mon, Apr 24, 2017 at 02:25:41PM +0300, Pierre Gaston wrote:
> On Mon, Apr 24, 2017 at 1:59 PM, <wer...@suse.de> wrote:
> 
> > (...)
> >
> > and yes
> >
> >         V_NAME=Friday
> >         for (( INDEX=0; INDEX<$((10-${#V_NAME})) ; INDEX++ ))
> >         do
> >             echo $INDEX
> >         done
> >
> > does also work, nevertheless using $(...) in the very first example is
> > allowed
> >
> >
> or even  for (( INDEX=0; INDEX<(10-${#V_NAME}) ; INDEX++ ))
> but otherwise yes, syntax looks ok

Yep ... the code could be more efficiently like

 V_NAME=Friday
 typeset -i len=$((10 - ${#V_NAME}))
 for (( INDEX=0; INDEX < len; INDEX++ )); do   echo $INDEX; done

... nevertheless even the intricate code should not cause an error I guess :)

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: signature.asc
Description: PGP signature

Reply via email to