mirror of
https://github.com/casey/just.git
synced 2024-11-26 11:43:43 +03:00
Mention "$@" in the README (#1064)
This commit is contained in:
parent
3372efefc3
commit
ef3629fae3
19
README.adoc
19
README.adoc
@ -619,6 +619,25 @@ foo
|
||||
hello
|
||||
```
|
||||
|
||||
When using an `sh`-compatible shell, such as `bash` or `zsh`, `$@` expands to the positional arguments given to the recipe, starting from one. When used within double quotes as `"$@"`, arguments including whitespace will be passed on as if they were double-quoted. That is, "$@" is equivalent to "$1" "$2"... When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).
|
||||
|
||||
This example recipe will print arguments one by one on separate lines:
|
||||
|
||||
```make
|
||||
set positional-arguments
|
||||
|
||||
@test *args='':
|
||||
bash -c 'while (( "$#" )); do echo - $1; shift; done' -- "$@"
|
||||
```
|
||||
|
||||
Running it with _two_ arguments:
|
||||
|
||||
```
|
||||
$ just test foo "bar baz"
|
||||
- foo
|
||||
- bar baz
|
||||
```
|
||||
|
||||
==== Shell
|
||||
|
||||
The `shell` setting controls the command used to invoke recipe lines and backticks. Shebang recipes are unaffected.
|
||||
|
Loading…
Reference in New Issue
Block a user