Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2008 13:34:18 -0700
From:      Dan Grillo <dan@grillo.net>
To:        Julian Elischer <julian@elischer.org>
Cc:        freebsd-hackers@freebsd.org, dino <dino@unitix.org>
Subject:   Re: bug in /bin/sh?!?
Message-ID:  <200804062034.m36KYItX085501@more.grillo.net>
References:  <47F8C1B3.4030902@unitix.org> <47F913AE.3040604@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Julian Elischer writes:
| dino wrote:
| > Hello,
| > 
| > on my FreeBSD 7.0-STABLE the line:
| > 
| >> sh -c 'set -- ${HOME+A B C}; echo "1:$1"; echo "2:$2:"; echo "3:$3:"'
| > 
| > prints
| > 
| > 1:A B C:
| > 2::
| > 3::
| > 
| > I would rather expect:
| > 
| > 1:A:
| > 2:B:
| > 3:C:
| > 
| > Is it correct that field splitting isn't performed on default/alternate
| > expanded values?
| > 
| 
| "A B C" is a single value tha thappens to contain spaces.
| so, yes there is no splitting at that point.

This is one place where bash and ash disagree:

~ redhat-linux-box[2]> /bin/bash
bash-3.00$ sh -c 'set -- ${HOME+A B C}; echo "1:$1"; echo "2:$2:"; echo "3:$3:"'
1:A
2:B:
3:C:
bash-3.00$ bash --version
GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.


			--Dan

-- 
  Dan Grillo   dan@grillo.net  650-299-1470



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804062034.m36KYItX085501>