Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some convincing explanation #2

Open
hv0905 opened this issue Sep 23, 2021 · 0 comments
Open

Some convincing explanation #2

hv0905 opened this issue Sep 23, 2021 · 0 comments

Comments

@hv0905
Copy link

hv0905 commented Sep 23, 2021

File Content

PowerShell reads file line by line, which works like .NET 's File.ReadAllLine(). which means, the $myLetter is a string array.
And $myLetter.Contains("Hi"); only searches in the first child of the array.

Space after `

This is obvious. ` escape any character in pwsh. Without the space, pwsh will escape the LF, and will seize

$aAndB = $a `
    -and $b

as one expression.

But with the space, ` will escape the space instead of the LF. and will seize the codes as two expressions.
$aAndB = $a will set $aAndB to true
-and $b is invalid and will be ignored.

In powershell, theory and practice are combined: Nothing works and nobody knows why.

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

No branches or pull requests

1 participant