bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Double-quoting of commandline args (problem if $1 as a string of more th


From: root wheel
Subject: Double-quoting of commandline args (problem if $1 as a string of more than 1 char)
Date: Sat, 2 Apr 2005 13:17:30 -0800 (PST)

Configuration Information [Automatically generated, do
not change]:
Machine: i586
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-2.05b
-L/usr/src/packages/BUILD/bash-2.05b/../readline-4.3
Compilation CFLAGS:  -DPROGRAM='bash'
-DCONF_HOSTTYPE='i586' -DCONF_OSTYPE='linux'
-DCONF_MACHTYPE='i586-suse-linux' -DCONF_VENDOR='suse'
-DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib 
-O2 -march=i586 -mcpu=i686 -fmessage-length=0
-D_GNU_SOURCE -Wall -pipe -g -fbranch-probabilities
uname output: Linux laptop 2.4.21-99-athlon #1 Wed Sep
24 13:34:32 UTC 2003 i686 athlon i386 GNU/Linux
Machine Type: i586-suse-linux

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        [Detailed description of the problem,
suggestion, or complaint.]


Double-quoting of commandline args seems to be broken
for $10 and above
if $1 is a double-quoted string of more than one
character.
Repeat-By:
        [Describe the sequence of events that causes
the problem
        to occur.]


address@hidden cat foo
#!/bin/sh
if [ $# -lt 12 ]
then
echo "need at least 12 args"
exit
else
echo $1
echo $2
echo $3
echo $4
echo $5
echo $6
echo $7
echo $8
echo $9
echo "$10"
echo "$11"
echo "$12"
fi
address@hidden ./foo 1 2 3 4 5 6 7 8 9 10 11 12
1
2
3
4
5
6
7
8
9
10
11
12
address@hidden ./foo "1" "2 2 2" 3 4 5 6 7 "8 8 8" 9
10 11 12
1
2 2 2
3
4
5
6
7
8 8 8
9
10
11
12
address@hidden ./foo "1 1" "2 2 2" 3 4 5 6 7 "8 8 8"
9 10 11 12
1 1
2 2 2
3
4
5
6
7
8 8 8
9
1 10
1 11
1 12
address@hidden
oops.
Also broken on later version of bash:
address@hidden:~> bash --version
GNU bash, version 3.00.0(1)-release (i586-suse-linux)
Copyright (C) 2004 Free Software Foundation, Inc.

address@hidden:~> ./foo "1 1" 2 3 "4 4 4" 5 6 7 8 9 10
11 12
1 1
2
3
4 4 4
5
6
7
8
9
1 10
1 11
1 12
address@hidden:~>

Configuration Information [Automatically generated, do
not change]:
Machine: i586
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.0
-L/usr/src/packages/BUILD/bash-3.0/../readline-5.0
Compilation CFLAGS:  -DPROGRAM='bash'
-DCONF_HOSTTYPE='i586' -DCONF_OSTYPE='linux'
-DCONF_MACHTYPE='i586-suse-linux' -DCONF_VENDOR='suse'
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib 
 -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall
-D_GNU_SOURCE -Wall -pipe -g -fbranch-probabilities
uname output: Linux linux 2.6.8-24-default #1 Wed Oct
6 09:16:23 UTC 2004 i686 athlon i386 GNU/Linux
Machine Type: i586-suse-linux

Bash Version: 3.0
Patch Level: 0
Release Status: release






                
__________________________________ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest




reply via email to

[Prev in Thread] Current Thread [Next in Thread]