delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/09/20/20:21:18

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4AB538A7.40401@columbus.rr.com>
References: <4AB538A7 DOT 40401 AT columbus DOT rr DOT com>
Date: Sun, 20 Sep 2009 20:21:04 -0400
Message-ID: <17393e3e0909201721h2fa073ffleb33c76325a85156@mail.gmail.com>
Subject: Re: typeset sem-failures in PD KSH v5.2.14 99/07/13.2
From: Matt Wozniski <godlygeek AT gmail DOT com>
To: pmcferrin AT columbus DOT rr DOT com, cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Sat, Sep 19, 2009 at 4:01 PM, Paul McFerrin wrote:
> Hello:
>
> The following simple script fails to produce a leading "0" on variable
> "nextnum". =C2=A0Am I doing something wrong or did I discover a bug?
>
> PD KSH v5.2.14 99/07/13.2
> /home/paul.$ cat /lbin/testit2
> #!/bin/pdksh
> n=3D"06"
> typeset -L2 nextnum
> nextnum=3D`expr $n + 01`
> echo $nextnum
>
> /home/paul.$ =C2=A0/lbin/testit2 =C2=A07

Looks like the correct behavior to me - the result is 7 (which is 06 +
1) left aligned, just like you asked for.  Were you looking for
"typeset -Z2" instead, for right aligned with zero padding in a field
of width two?

~Matt

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019