help-bash
[Top][All Lists]
Advanced

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

Re: Expansion of unquoted special parameter $@ when used as the word for


From: G. Branden Robinson
Subject: Re: Expansion of unquoted special parameter $@ when used as the word for a HERE STRING
Date: Wed, 6 Nov 2019 08:28:49 +1100
User-agent: NeoMutt/20180716

At 2019-11-05T10:30:39-1000, Robin A. Meade wrote:
> Consider:
> 
> set a 'b   c'
> cat <<< $@;
> 
> The output is:
> 
> a b c
> 
> I expected the 3 spaces between b and c to be preserved.

You've got to double-quote $@ for it to work the way you desire:

cat <<< "$@"

Without quoting, $@ works like $*.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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