Skip to content

Commit

Permalink
Update the update-hosts-ips script to only modify lines starting with…
Browse files Browse the repository at this point in the history
… IP addresses.
  • Loading branch information
patrickcarlohickman committed Feb 19, 2023
1 parent 64161b1 commit d419e21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/update-hosts-ips.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$wslTld = 'test'

$file = $env:windir + '\System32\drivers\etc\hosts'
$regex = '(?<=^\s*)([^\s]+)(?=.*\.' + $wslTld + '(\s+|$))'
$regex = '(?<=^\s*)(\d+\.\d+\.\d+\.\d+)(?=.*\.' + $wslTld + '(\s+|$))'

# Get the current IP address of the wsl instance.
$wslIp = $(wsl -e hostname -I).Trim()
Expand Down

0 comments on commit d419e21

Please sign in to comment.