Skip to content

Instantly share code, notes, and snippets.

@iso2022jp
Last active November 2, 2023 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iso2022jp/659048a3a5784fffd9929d783a60a235 to your computer and use it in GitHub Desktop.
Save iso2022jp/659048a3a5784fffd9929d783a60a235 to your computer and use it in GitHub Desktop.
Run wls on the host directory with SMB
@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