title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
x
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
|
Wednesday, January 07, 2015 | |
From this StackOverflow answer:
Argh. That's putting it mildly. Here's some slightly amended code from the StackOverflow question to which the above quote is responding:
Guess which one works and which doesn't? The crux seems to be that the ForEach loop, where ForEach leads the line, is a conventional loop, but the Foreach-Object that you so commonly see with the How complicated is this? Check this blog post (that I stole the phrase "looping cmdlet" from)...
(emphasis is mine) ForEach should be ForEach, if you ask me, but luckily nobody did, as I think the point is that when you're mid-pipeline, there's no real way to refer to what came down from the pipeline into your command, afaik. That is, this is meaningless...
... because $PIPELINE_VALUE doesn't exist. Pipeline values are only implicitly sent along -- unless, of course, you're pulling them up as a parameter in a module or function. Creating a $PIPELINE_VALUE variable, though horribly useful for .NET-threaded heads like mine, would break [2] PowerShell's useful pipeline paradigm. The limitation with the lack of
You're going to run through all 1 to 100, afaict. So to ForEach proper, you need a two-stepped process (or you have to use a Fun. I should rename this blog "PowerShell Commando". [2] Okay, literally that's wrong. It would "encourage breaking from PowerShell's pipeline paradigm for a more .NET-ish one". Labels: powershell posted by ruffin at 1/07/2015 10:33:00 AM |
|
| |
All posts can be accessed here: Just the last year o' posts: |
||||||||||||||||||||||
|