Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Add the magic back: $@ -> "$@" #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JimDennis
Copy link

In bash "$@" is magic (expand arguments while preserving their boundaries). $@ is equivalent to $* and
"$*" is "interpolate all arguments into a single string, separated by the first character of the $IFS value.

Properly wrapping a command and preserving any arguments as they were quoted/escaped on the command line
requires "$@" ... the "magic" form of this variable.

In bash "$@" is magic (expand arguments while preserving their boundaries). $@ is equivalent to $* and
"$*" is "interpolate all arguments into a single string, separated by the first character of the $IFS value.

Properly wrapping a command and preserving any arguments as they were quoted/escaped on the command line
requires "$@" ... the "magic" form of this variable.
@defunctzombie
Copy link
Owner

So I am always so hesitant to change anything in this repo mostly because it doesn't have tests and I can never be sure what the latest ongoings with coreos and ansible are (I use neither anymore). Would it be possible to add some sort of tests that can be run for this stuff or even instructions to the wiki to do so? Then I would feel better about merging in stuff.

@JimDennis
Copy link
Author

Roman,

Okay, I'll look at a little test suite.

I can easily write a test showing the failure mode when you don't have
"$@" which, of course, will pass with it.

Basically if you call runner.sh with a argument list like: this "that
other thing" ... then the $@ will treat that as 4
arguments while "$@" will have 2 arguments: $1 : this and $2: that other
thing

But I'll have to see how your test harness works to figure out where to
put such a test and how to capture/evaluate
the results.

On Thu, Aug 25, 2016 at 9:44 AM, Roman Shtylman [email protected]
wrote:

So I am always so hesitant to change anything in this repo mostly because
it doesn't have tests and I can never be sure what the latest ongoings with
coreos and ansible are (I use neither anymore). Would it be possible to add
some sort of tests that can be run for this stuff or even instructions to
the wiki to do so? Then I would feel better about merging in stuff.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#34 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADoGFsy8bAVgMOKJgCGopBhF0ngA1QN0ks5qjcZygaJpZM4JsfQ0
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants