Bug 71388

Summary: Array initialisation using $@ works as $*
Product: [Retired] Red Hat Linux Reporter: James Antill <james.antill>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-09-26 01:56:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Antill 2002-08-12 22:16:50 UTC
Description of Problem:
 When you initialise an array using ARRAY=($@) the variables get expanded as if
you had used $*.

Version-Release number of selected component (if applicable):
 bash-2.05a-13

How Reproducible:
 Always

Steps to Reproduce:
1. Run attached script

Actual Results:
 Script prints.
2
3
3
3
3

Expected Results:
 Script prints.
2
2
3
2
3


Additional Information:
 Here is the script...

#! /bin/bash

function f()
{
 A=($@)
 B=($*)

 echo $#
 echo ${#A[@]}
 echo ${#B[@]}
 echo ${#A[*]}
 echo ${#B[*]}
}

f a "b c"

Comment 1 Tim Waugh 2002-10-11 11:13:45 UTC
You forgot to quote $@.