Article View: gnu.bash.bug
Article #821bash doesn't handle ${<number>:-<stuff>} correctly...
From: Thomas M. Breuel
Date: Sat, 09 Dec 1989 03:51
Date: Sat, 09 Dec 1989 03:51
36 lines
841 bytes
841 bytes
See the following transcript
team$ seq 1 10 | head -15 <--- using bash
1 9999999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Broken pipe
team$ sh seq 1 10 <--- using /bin/sh
1 10
1
2
3
4
5
6
7
8
9
10
team$ cat seq
from=${1:-1} <-------+-------------- these substitutions probably fail
to=${2:-9999999} <---/
echo $from $to
awk 'BEGIN{for(i='$from';i<='$to';i++) print i; exit}'
team$
Technical Details
Message-ID:
<8912090351.AA00729@team>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AI.MIT.EDU!tmbShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AI.MIT.EDU!tmb
From: tmb@AI.MIT.EDU (Thomas M. Breuel)
Newsgroups: gnu.bash.bug
Subject: bash doesn't handle ${<number>:-<stuff>} correctly...
Message-ID: <8912090351.AA00729@team>
Date: 9 Dec 89 03:51:22 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 36