From owner-freebsd-questions@FreeBSD.ORG Tue Feb 6 02:36:05 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F87716A400 for ; Tue, 6 Feb 2007 02:36:05 +0000 (UTC) (envelope-from gs_stoller@juno.com) Received: from outbound-mail.nyc.untd.com (outbound-mail.nyc.untd.com [64.136.20.164]) by mx1.freebsd.org (Postfix) with SMTP id AA6E313C428 for ; Tue, 6 Feb 2007 02:36:04 +0000 (UTC) (envelope-from gs_stoller@juno.com) Received: from webmail30.nyc.untd.com (webmail30.nyc.untd.com [10.141.27.170]) by smtpout01.nyc.untd.com with SMTP id AABC6R4NDAZA8WTA for (sender ); Mon, 5 Feb 2007 18:35:47 -0800 (PST) X-UNTD-OriginStamp: /s5f1SIGSI3+WdnoYQ8yRFUpjArbWpxJt7atpdw6c72wXMh1kZMttQ== Received: (from gs_stoller@juno.com) by webmail30.nyc.untd.com (jqueuemail) id MDU5H2CY; Mon, 05 Feb 2007 18:34:52 PST Received: from [67.84.52.37] by webmail30.nyc.untd.com with HTTP: Tue, 6 Feb 2007 02:34:11 GMT X-Originating-IP: [67.84.52.37] Mime-Version: 1.0 From: "gs_stoller@juno.com" Date: Tue, 6 Feb 2007 02:34:11 GMT To: tigger@lvlworld.com X-Mailer: Webmail Version 4.0 Message-Id: <20070205.183452.10246.1290258@webmail30.nyc.untd.com> X-ContentStamp: 6:3:1382109753 X-MAIL-INFO: 0871c8ac0119fc19fc8d4800a529e11da54c2d18002cf9 X-UNTD-Peer-Info: 10.141.27.170|webmail30.nyc.untd.com|webmail30.nyc.untd.com|gs_stoller@juno.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: RE: unexpected result from sh script with `date` X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2007 02:36:05 -0000 On Fri, 2 Feb 2007 22:11:56 +1100, Tigger wrote= > Hello, the following simply sh script is outputting unexpected results= . > Any idea why? > --script-- > #!/bin/sh > started=3D`date` > echo "Started at: $started" > echo "Finished : "`date` > exit > --output-- > Started at: Fri Feb 2 22:13:51 EST 2007 > Finished : Fri Feb 2 22:13:51 EST 2007 > --problem-- > Between 'Feb' and '2', there is two spaces on the 'Started at' line, > however the 'Finished' one only has 1 space. > I know this sounds picky, but I was not expecting this at all. It is not a problem with date , it did the same thing both times. The= echo command coalesces consecutive blank space characters down to one= blank unless they are quoted. If you change the line echo "Finished : "`date` to be echo "Finished : `date`" it will do what you expect. [snip] =