Last active
November 2, 2023 03:01
-
-
Save iso2022jp/659048a3a5784fffd9929d783a60a235 to your computer and use it in GitHub Desktop.
Run wls on the host directory with SMB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
: Prerequisite: share C: with "C", user "foo" accessible | |
wsl -- ^ | |
set -euxo pipefail; ^ | |
[[ ! -d /mnt/c2 ]] ^|^| mount ^| grep '/mnt/c2' ^|^| sudo find '/mnt/c2' -type d -empty -delete; ^ | |
[[ -d /mnt/c2 ]] ^|^| sudo mkdir /mnt/c2; ^ | |
grep -qs '/mnt/c2 ' /proc/mounts ^|^| sudo mount -t cifs -o user=foo,nobrl,noperm,cache=none,actimeo=0,iocharset=utf8 //$^(grep nameserver /etc/resolv.conf ^| grep '\.' ^| cut -f2 -d' '^)/C /mnt/c2; ^ | |
cd ${PWD/#\/mnt\/c\///mnt/c2/}; ^ | |
bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment