help-guix
[Top][All Lists]
Advanced

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

Re: Am I doing it all wrong?


From: Saku Laesvuori
Subject: Re: Am I doing it all wrong?
Date: Sun, 28 Aug 2022 17:10:54 +0300

> > Also, that should probably be "$@", just in case.
> 
> I don't think it'll make any difference; if, say, "foo" "bar" "baz" is
> passed, both $@ and "$@" will expand to "foo" "bar" "baz" (yes, bypassing
> the quotes).
> 
> According to POSIX.1-2017's specification of `sh`:
> 
>   When the expansion occurs within double-quotes, the behavior is unspecified
>   unless one of the following is true:
> 
>   + Field splitting [...] would be performed if the expansion were not within
>     double-quotes [...].
> 
>   + [...]
> 
> So, $@ == "$@".

It does actually make a difference if the arguments have spaces. Given
arguments "foo" and "foo bar", $@ expands to "foo" "foo" "bar" and "$@"
expands to "foo" "foo bar".

- Saku Laesvuori

Attachment: signature.asc
Description: PGP signature


reply via email to

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