Reputation: 5245
I need to test symlinks (junctions) created in WSL (via ln
), because they may not always be valid.
The simplest test I could find is to verify the output of:
(Get-Item %FILENAME%).Target
which is blank if the junction is invalid.
However, there's an edge case where this test returns a false negative, that is, when a file junction points to a directory.
Is there some (very simple) command I can run to perform a test that covers also this case?
The test needs to be able to be executed from a Bash script inside WSL (to be specific, the command above is run via [[ -z $(powershell.exe -Command "(Get-Item %FILENAME%).Target")
).
Upvotes: 0
Views: 14