Unlike my last post, this one is a naked attempt to get clicks.
See, today Google emailed me with a suggestion to try it’s “experimental” content ideas, saying that I could “get inspiration for new content from Google” for a limited time only.
I’m unclear on whether this is Google saying, “Blog about this and we’ll increase your search rankings” or if they are saying, “Here’s a search term we want to increase the auction rate for.” Maybe, it’s both. Take a look at a screenshot of the topics they suggested for this blog. Note that they got the main categories right — but the suggested topics seem oddly mechanical.
In any case, who am I to argue with Google? So, here’s an easy explanation of what $()
means in PowerShell. (I thought about blogging on the potentially charged question, “Do I need AWS?” But you can see why that would’ve gone nowhere.)
$()
, or “dollar parentheses,” is a PowerShell sub-expression, documented in the usual terse PowerShell way in about-Operators
. In plain English, a sub-expression tells PowerShell to evaluate the expression contained in the parentheses.
It’s a quick and useful way to make strings out of parts of objects. One often needs to do this when an object has been returned and you want to write it out via Export-Csv
.
What trips most people up is when they write an object to the console, PowerShell converts it for you. But if you are going to use the object in any other way, you are responsible for transforming it — and making the data you want into a string using a sub-expression is a handy way to do so. I blogged about this years ago in a discussion of how to nicely format Azure PowerShell objects.
Well, there you go, Google. I’ve done what you told me to. Now what? 🙂
Leave a Reply