Johannes Sixt [off-list ref] writes:
quoted
+for prerequisite in $(echo "$1" | tr , ' ')
So, you dislike the space separator, but you also dislike the IFS games
that save a few new processes? ;) (Think of Windows, where fork is expensive).
You can play IFS=, game, then ;-)
I have to admit that it feels so 80'ish, back when our UNIX machines were
so slow that we tried to shave every fork+exec from our shell scripts by
using built-ins when possible, though.
2009/5/8 Junio C Hamano [off-list ref]:
Johannes Sixt [off-list ref] writes:
quoted
quoted
+for prerequisite in $(echo "$1" | tr , ' ')
So, you dislike the space separator, but you also dislike the IFS games
that save a few new processes? ;) (Think of Windows, where fork is expensive).
You can play IFS=, game, then ;-)
I have to admit that it feels so 80'ish, back when our UNIX machines were
so slow that we tried to shave every fork+exec from our shell scripts by
using built-ins when possible, though.
Well, on Windows (at least with Cygwin), it is 80's still. My workstation
(a 2.4GHz P4, 70C hot, 2Gb Dell monster) is about 100x slower than my
old Asus laptop (a 384Mb, 1200Ghz Pentium-M) in starting a trivial program
("int main() { return 0; }").
I'm trying to save where possible on cygwin, whatever cost.
Here is some testing that does not require a sub-shell and does support
options:
rhf2-1:~/tmp>foof() { local IFS=' ,+';local args="$*"; for i in
$args; do echo i=$i; done; }
rhf2-1:~/tmp>foo1() { for i; do echo i=$i; done; }
rhf2-1:~/tmp>foo2() { for i in $*; do echo i=$i; done; }
rhf2-1:~/tmp>foo1 'a b c' d e+f g,h 'j k'
i=a b c
i=d
i=e+f
i=g,h
i=j k
rhf2-1:~/tmp>foo2 'a b c' d e+f g,h 'j k'
i=a
i=b
i=c
i=d
i=e+f
i=g,h
i=j
i=k
rhf2-1:~/tmp>foof 'a b c' d e+f g,h 'j k'
i=a
i=b
i=c
i=d
i=e
i=f
i=g
i=h
i=j
i=k
rhf2-1:~/tmp>uname -a
CYGWIN_NT-5.1 rhf2-1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
Note: that should be IFS=$' \t+,' and $'j\tk' in case the mailer messes
this up. I did not use this bash special syntax.
So which should we go with? foo2() which does the original way or foof()
which allows you to use ',' and '+', and spaces?
-Don
-------- Original Message --------
Subject: Re: Tests in Cygwin
From: Alex Riesen <redacted>
To: Junio C Hamano <redacted>
Date: 5/8/2009 5:28 AM2009/5/8 Junio C Hamano [off-list ref]:
quoted
Johannes Sixt [off-list ref] writes:
quoted
quoted
+for prerequisite in $(echo "$1" | tr , ' ')
So, you dislike the space separator, but you also dislike the IFS games
that save a few new processes? ;) (Think of Windows, where fork is expensive).
You can play IFS=, game, then ;-)
I have to admit that it feels so 80'ish, back when our UNIX machines were
so slow that we tried to shave every fork+exec from our shell scripts by
using built-ins when possible, though.
Well, on Windows (at least with Cygwin), it is 80's still. My workstation
(a 2.4GHz P4, 70C hot, 2Gb Dell monster) is about 100x slower than my
old Asus laptop (a 384Mb, 1200Ghz Pentium-M) in starting a trivial program
("int main() { return 0; }").
I'm trying to save where possible on cygwin, whatever cost.
__________________________________________________________________________________________________________________
DISCLAIMER:"The information contained in this message and the attachments (if any) may be privileged and confidential and protected from disclosure. You are hereby notified that any unauthorized use, dissemination, distribution or copying of this communication, review, retransmission, or taking of any action based upon this information, by persons or entities other than the intended recipient, is strictly prohibited. If you are not the intended recipient or an employee or agent responsible for delivering this message, and have received this communication in error, please notify us immediately by replying to the message and kindly delete the original message, attachments, if any, and all its copies from your computer system. Thank you for your cooperation."
________________________________________________________________________________________________________________
Don Slutz schrieb:
So which should we go with? foo2() which does the original way or foof()
which allows you to use ',' and '+', and spaces?
I'd say take Junio's original proposal (that separates with spaces), but use
for prerequisite in $* # split args at spaces
(including the comment!) instead of merely
for prerequisite
I can certainly live with the quoting at the call sites of
test_expect_success that is needed in the few cases where there is more
than one prerequisite.
-- Hannes
2009/5/8 Don Slutz [off-list ref]:
Here is some testing that does not require a sub-shell and does support
options:
rhf2-1:~/tmp>foof() { local IFS=' ,+';local args="$*"; for i in $args;
do echo i=$i; done; }
I like this :)