Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14110
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Ilkka Virta <itvirta@iki.fi> |
| Newsgroups | gnu.bash.bug |
| Subject | Documentation for a="$@" |
| Date | Sat, 19 May 2018 22:40:24 +0300 |
| Lines | 40 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.88.1526758841.1292.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1526758842 30172 208.118.235.17 (19 May 2018 19:40:42 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
| Content-Language | en-US |
| X-SASI-RCODE | 200 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=to:from:subject:message-id:date:mime-version:content-type:content-transfer-encoding; s=smtp; bh=C23gQ919hD1E2I5ejyjARJzLxU8w7YvGSFMR+vR4TZU=; b=0cwS9mmqQmXWB04g1+LSVtwfg3ytYbBR7lwb4QPclwKswD3VXkd5t8O2xuX+4BBrksrzruRCssMjOih5QpsNzBw2atxQNDbN2mg0n9zSEpv/4+C+KSHKALGHNnguP/jyiHJVWcFZLqEpx2zs03PWOWZtS7tMK9WqK/Gdr5fyYm5oU+i1D3E5W9RnwgqGF3GBBMXFUkbvoABsPraVZ70Olks7wYyFcSAObQJqK5sU/mQ75CHnZJPBJ5X6OiEqnl5+pOH4W7cX0CLOszMYu1COePPdhvMhWm6ldzW98ShNhfXoOI2jmMNnFJptzemE/EJDhmXLp8m7n6J3DSgAQUbFOA== |
| X-detected-operating-system | by eggs.gnu.org: FreeBSD 8.x [fuzzy] |
| X-Received-From | 157.24.2.104 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14110 |
Show key headers only | View raw
In Bash, using "$@" in an assignment, (as in a="$@" ) concatenates the positional parameters to single string, joined with spaces. Somewhat similarly to what "$*" does, except that $* uses the first letter of IFS, but $@ always uses a space. However, I can't see this documented in the manual, is it somewhere? "3.4 Shell Parameters" [1] discusses assignments to variables, and there's the phrase: "Word splitting is not performed, with the exception of "$@" as explained below." But the actual explanation seems to be missing, as there's no other mention of $@ on the page. There's also no mention of assignments under "3.4.2 Special Parameters" [2]. It simply states that "$@" expands to separate words. I'd suggest adding something like this to the description of $@ in 3.4.2: "" If $@ or "$@" is used on the right hand side of an assignment to a variable, it instead expands to a single word with the value of each positional parameter separated by a space. That is, a="$@" is equivalent to a="$1 $2 ...". "" (It seems the online manual is an older version than that in git, but I didn't see this mentioned in the devel version of the manual either.) [1] https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html [2] https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html -- Ilkka Virta / itvirta@iki.fi
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Documentation for a="$@" Ilkka Virta <itvirta@iki.fi> - 2018-05-19 22:40 +0300
csiph-web