No. Splatting does _NOTHING_ to address the quoting issue I raised. It does not allow you to pass arbitrary argument words to external programs. Your technique actually makes the problem _WORSE_ because you lose the identity of individual arguments which CAN contain spaces_and which you DO need to quote. You've utterly failed to even comprehend my basic point. This conversation is over.
Posted Dec 8, 2011 22:28 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
[Link]
Can you show me what EXACTLY you are trying to do? Paste a piece of code here, including the parts which receive parameters.
Evolution of shells in Linux (developerWorks)
Posted Dec 9, 2011 12:25 UTC (Fri) by nix (subscriber, #2304)
[Link]
quotemstr is trying to show you faults in the Windows command-line parsing system by using whoami as a tool to indicate the contents of the first argument.
You are treating it as if he wants to run 'whoami' but doesn't know how.
When a finger points at the moon...
Evolution of shells in Linux (developerWorks)
Posted Dec 10, 2011 3:00 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
[Link]
I understand that 'whoami' is used as an example.
I finally understood what author wants and gave an answer: "@($var -split ' ')". It does the braindead thing that was requested.
Why braindead? Because good PowerShell scripts would just use an _array_ and 'splat' it when required, instead of constructing shell arguments as raw strings.
And no, this hack with splitting string into arguments is definitely not required to work with legacy code.
Evolution of shells in Linux (developerWorks)
Posted Dec 10, 2011 3:01 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
[Link]
Try it. It does EXACTLY what you've requested - passes a string as a number of arguments, split by spaces.