mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Fix shell quoting in docker example (#3225)
This changes the use of `$@` to have double quotes, which avoids double shell expansion of arguments to the function. Example: ``` $ function tx { ls $@; } $ tx a b ls: cannot access 'a': No such file or directory ls: cannot access 'b': No such file or directory $ tx 'a b' ls: cannot access 'a': No such file or directory ls: cannot access 'b': No such file or directory $ function tx { ls "$@"; } $ tx a b ls: cannot access 'a': No such file or directory ls: cannot access 'b': No such file or directory $ tx 'a b' ls: cannot access 'a b': No such file or directory $ ``` Observe how in the corrected version the `'a b'` test case (a single argument with a space inside) is handled correctly, while with the original version the space is exposed to the shell, and the string is broken up. Signed-off-by: David Schmitt <david.schmitt@puppet.com>
This commit is contained in:
parent
fee139bafb
commit
8f096ec667
1 changed files with 1 additions and 1 deletions
|
@ -90,7 +90,7 @@ For Linux:
|
|||
|
||||
```
|
||||
docker pull chef/inspec
|
||||
function inspec { docker run -it --rm -v $(pwd):/share chef/inspec $@; }
|
||||
function inspec { docker run -it --rm -v $(pwd):/share chef/inspec "$@"; }
|
||||
```
|
||||
|
||||
For Windows (PowerShell):
|
||||
|
|
Loading…
Reference in a new issue