From owner-freebsd-questions@freebsd.org Wed Feb 3 03:39:05 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BD12A99E42 for ; Wed, 3 Feb 2016 03:39:05 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FC6E1F4 for ; Wed, 3 Feb 2016 03:39:05 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-pf0-x233.google.com with SMTP id o185so5819706pfb.1 for ; Tue, 02 Feb 2016 19:39:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=wrRIJMbCWq9r0VzjmhpTDvNkrulQT8f9SCP2lCwlO10=; b=n2hfmYVDMb4KqqtjhjNxRNk+W/sXm/xuBWTUPfLrVnznLKkudzSxv1pgknRD7f3D1J N3u0VvX+LT4M2QoqpWCSA7jcxZLHj31la/rGUak4lnUjlQT+fvNUdNAc2mfLpivvNm18 6ysdp4os/LzfTdpEpKpziofoz20yRkkmeRwJQQ/aKHll9ZWOZiw+yxc4ms5Eon9Wy3ei +gEzc9UGADOXEb/ShdNr5l/bYMqG+0Jb+8C6C2lNp/g18jkVbMAP0sK0vTqieFgl7gxV i6KMwYyafuCoAfllJ1l4ZGRj8ml+DP9jXjTCFipBs/LHuFK9mZO3EtM5VVrwJLlEbDTd /pOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=wrRIJMbCWq9r0VzjmhpTDvNkrulQT8f9SCP2lCwlO10=; b=I0gRCzMs+/TeEWWk/DrfmRr0W3yNz5iAhvnZUaeykzNcBnBj9TSfZ7Yx9X7twnPJex CUq85noIPnVPOFU1/XcIhyI2t/nVjj01pHiYRuzZna9GUjuM4el45s5rVM4/twmHRrPw 2W5BpuQ/83amF3HBiHA8Mrj4hqWJRiNjf7Z++ghz0D9QphLrXh39KJZ+HJIo6BJ+OfPA 3q9d6LlnVUgD92k9T0MuyjP0MThylEe3jaZC2WMh5ivFrgjfvvrZZeQIEkHOWw0hjM/A g4abBHkll6p3EMwjCbFPW7XmIgt/FM9U8hcrsWxB8VhWS45RIS1bPcYZk4utV9GgdcDb p2hQ== X-Gm-Message-State: AG10YOTIf2yPQ1EK2hSQRM9ZYTU4m10UAOuMAhGMPEHYps1GqdlY6M5lcss+eYuTt/ewlQ== X-Received: by 10.98.9.92 with SMTP id e89mr21410264pfd.34.1454470744634; Tue, 02 Feb 2016 19:39:04 -0800 (PST) Received: from [192.168.1.139] ([120.29.76.9]) by smtp.googlemail.com with ESMTPSA id m86sm5785764pfi.27.2016.02.02.19.39.02 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Feb 2016 19:39:03 -0800 (PST) Message-ID: <56B1765D.2060800@gmail.com> Date: Wed, 03 Feb 2016 11:39:09 +0800 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Freebsd Questions Subject: sh script help with numeric values Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2016 03:39:05 -0000 Hello list I am having trouble getting leading zeros to show up. The following is an example of what i mean. dirname="dir" dup_count=000 dup_times=5 while [ "${dup_count}" -ne "${dup_times}" ]; do dup_count=$(( $dup_count + 001 )) dname="${dirname}-${dup_count}" echo "${dname}" done Outputs this dir-1 dir-2 dir-3 dir-4 dir-5 What I really want to see is this dir-001 dir-002 dir-003 dir-004 dir-005 dir-013 dir-111 ect How do I get the leading zeros to show? Thanks for your help