With 7.0.3 the ?. operator works on Windows but not Linux.
$test = @{ field = 'value' }
${test}?.field
value
ParserError: You must provide a value expression following the '?' operator.
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Linux 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
You need to enable this experimental feature in 7.0.3:
Enable-ExperimentalFeature PSNullConditionalOperators
You need to enable this experimental feature in 7.0.3:
Enable-ExperimentalFeature PSNullConditionalOperators
Hmm... I didn't think I had enabled any of them but that one option is turned on so I guess I did. Sorry for not recognizing that.
No worries. :-)
Just an FYI
This experimental feature seems already included in 7.1.0-Preview.6.
:)
User error. Didn't realize I'd at some point enabled this experimental feature on my Windows machine - I assume I did it though if so, no recollection and the others weren't enabled.
In any event, easy remedy to enable on Linux.
Most helpful comment
You need to enable this experimental feature in 7.0.3: