delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/30/10:10:00

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_33,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <49F98B26.2070007@cornell.edu>
References: <49F98B26 DOT 2070007 AT cornell DOT edu>
Date: Thu, 30 Apr 2009 10:09:35 -0400
Message-ID: <f60fe000904300709m301afdc6j70f39327f640a538@mail.gmail.com>
Subject: Re: Bash problem
From: "Mark J. Reed" <markjreed AT gmail DOT com>
To: 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 Thu, Apr 30, 2009 at 7:27 AM, Ken Brown
> A build script I was running failed because it had a command of > the form 'eval foo=bar time <command>'.

That won't work because time is a special shell keyword, and as such
only recognized when it's the first word on the command line. The same
is true of all shell syntax-driving keywords such as "case", "for",
"while", etc.  (But not for simple built-in commands, which can appear
anywhere the name of an actual command program on disk can).

> I have access to a linux system in which the original command > (with foo=bar) works.

That just means that the Linux system has the standalone time(1)
command installed.  As it happens, my Cygwin install also has a
/bin/time.

You can just move the assignment to after the 'time':

eval time foo=bar env | grep foo

real    0m0.120s
user    0m0.000s
sys     0m0.078s
foo=bar



-- 
Mark J. Reed <markjreed AT gmail DOT com>

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

- Raw text -


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