use long form of command line options where possible

master
Alan Faubert 2 years ago
parent 3098567766
commit 58e54dc80c
  1. 2
      bash/README.md
  2. 8
      bash/scripts/2path.sh
  3. 2
      bash/scripts/syncfiles.sh
  4. 58
      config.sh
  5. 4
      git/scripts/git-clean-branches
  6. 2
      git/scripts/git-clean-dates
  7. 6
      git/scripts/git-clean-fork
  8. 2
      git/scripts/git-clean-modes
  9. 2
      git/scripts/git-clean-mtime
  10. 2
      git/scripts/git-clean-pr
  11. 2
      git/scripts/git-clean-user
  12. 2
      git/scripts/git-cpr
  13. 8
      git/scripts/git-download-bundle
  14. 12
      git/scripts/git-npm-add
  15. 16
      git/scripts/git-snapshot
  16. 2
      git/wsl/git-credential-manager
  17. 2
      nodejs/scripts/npma.sh
  18. 12
      nodejs/scripts/npmg.sh
  19. 4
      nodejs/scripts/npml.sh
  20. 32
      tmux/.tmux.conf
  21. 2
      wsl/install.cmd
  22. 4
      wsl/scripts/wsl-expose-ports
  23. 2
      wsl/scripts/wsl-fix-clock
  24. 2
      wsl/scripts/wsl-fix-interop
  25. 2
      wsl/wsl-elevate

@ -11,6 +11,6 @@ Add this to `/etc/bash.bashrc`
```bash
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
eval $(dircolors -b)
eval $(dircolors --sh)
alias ls='ls --color=auto'
```

@ -1,9 +1,9 @@
#!/bin/sh
if [ $# = 0 ]; then >&2 echo 'Arguments: <executable file>...'; exit 1; fi
mkdir -p ~/bin
mkdir --parents ~/bin
for bin in "$@"; do
target="$(readlink -e "$bin")" &&
target="$(readlink --canonicalize "$bin")" &&
link="$([ -d "$target" ] && echo "$target" | sed s!/!_!g || basename "$bin")" &&
rm -rf ~/bin/"$link" &&
ln -s "$target" ~/bin/"$link"
rm --force --recursive ~/bin/"$link" &&
ln --symbolic "$target" ~/bin/"$link"
done

@ -6,7 +6,7 @@ for file in "$@"; do
done
for file in "$@"; do
[ "$newest" -nt "$file" ] || continue
read -rp "$newest -> $file ? [y/n] " -N1 r
read -N 1 -p "$newest -> $file ? [y/n] " -r r
echo
[ "$r" = y ] && cp --preserve "$newest" "$file"
done

@ -1,5 +1,5 @@
#!/bin/bash
cd "$(dirname "$(readlink -e "$0")")"
cd "$(dirname "$(readlink --canonicalize "$0")")"
root_win="$(wslpath -w .)"
root_win_slash="$(wslpath -m .)"
while :; do
@ -16,52 +16,52 @@ while :; do
--notags --default-item "$action" 3>&2 2>&1 1>&3-)"
case "$action" in
wsl-resolvconf)
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- rm /etc/resolv.conf
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- echo $'nameserver 1.1.1.1\nnameserver 1.0.0.1' \> /etc/resolv.conf
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- rm /etc/resolv.conf
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- echo $'nameserver 1.1.1.1\nnameserver 1.0.0.1' \> /etc/resolv.conf
;;
wsl-hosts)
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- ln -frs "$(wslpath "$(wslvar WINDIR)")"/System32/drivers/etc/hosts /etc/hosts
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- ln --force --relative --symbolic "$(wslpath "$(wslvar WINDIR)")"/System32/drivers/etc/hosts /etc/hosts
;;
wsl-elevate)
wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- ln -frs wsl/wsl-elevate /usr/local/bin/wsl-elevate
wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- ln --force --relative --symbolic wsl/wsl-elevate /usr/local/bin/wsl-elevate
;;
wsl-scripts)
bash/scripts/2path.sh wsl/scripts
;;
wsl-win)
rm -rf ~/win &&
ln -rs "$(wslpath "$(wslvar USERPROFILE)")" ~/win
rm --force --recursive ~/win &&
ln --relative --symbolic "$(wslpath "$(wslvar USERPROFILE)")" ~/win
;;
wsl-wsltty)
(cmd.exe /c rmdir /s /q "%APPDATA%\wsltty" 2\> nul; cmd.exe /c mklink /d "%APPDATA%\wsltty" "$root_win\wsl\wsltty")
;;
bash-profile)
ln -frs bash/.profile ~/.profile
ln --force --relative --symbolic bash/.profile ~/.profile
;;
bash-scripts)
bash/scripts/2path.sh bash/scripts
;;
ssh)
rm -rf ~/.ssh &&
ln -rs ssh/config ~/.ssh &&
rm --force --recursive ~/.ssh &&
ln --relative --symbolic ssh/config ~/.ssh &&
chmod 600 ~/.ssh/*
;;
ssh-win)
(cmd.exe /c rmdir /s /q "%USERPROFILE%\.ssh" 2\> nul; cmd.exe /c mklink /d "%USERPROFILE%\.ssh" "$root_win\ssh\config")
;;
git)
ln -frs git/.gitconfig ~/.gitconfig
ln --force --relative --symbolic git/.gitconfig ~/.gitconfig
;;
git-win)
(cmd.exe /c del "%USERPROFILE%\.gitconfig" 2\> nul; cmd.exe /c mklink "%USERPROFILE%\.gitconfig" "$root_win\git\.gitconfig")
;;
git-delta)
mkdir -p ~/.bin &&
wget https://github.com"$(curl -s https://github.com/dandavison/delta/releases | grep -m1 -o '[^\"]*x86_64-unknown-linux-gnu[^\"]*')" -O- | tar xzO --strip-components=1 --no-anchored delta > ~/.bin/git-delta &&
mkdir --parents ~/.bin &&
wget https://github.com"$(curl --silent https://github.com/dandavison/delta/releases | grep --max-count=1 --only-matching '[^\"]*x86_64-unknown-linux-gnu[^\"]*')" --output-document=- | tar --extract --gzip --no-anchored --strip-components=1 --to-stdout delta > ~/.bin/git-delta &&
chmod +x ~/.bin/git-delta
;;
git-filter-repo)
([ -d ~/.bin/git-filter-repo ] || (mkdir -p ~/.bin && git clone https://github.com/newren/git-filter-repo ~/.bin/git-filter-repo)) &&
([ -d ~/.bin/git-filter-repo ] || (mkdir --parents ~/.bin && git clone https://github.com/newren/git-filter-repo ~/.bin/git-filter-repo)) &&
bash/scripts/2path.sh ~/.bin/git-filter-repo/git-filter-repo
;;
git-scripts)
@ -71,9 +71,9 @@ while :; do
code --install-extension dbaeumer.vscode-eslint --install-extension eamodio.gitlens --install-extension esbenp.prettier-vscode --install-extension ms-vscode-remote.vscode-remote-extensionpack --install-extension pkief.material-icon-theme --install-extension streetsidesoftware.code-spell-checker --install-extension svelte.svelte-vscode
;;
vscode-linux)
mkdir -p ~/.config/Code/User &&
ln -frs vscode/keybindings.json ~/.config/Code/User/keybindings.json &&
ln -frs vscode/settings.json ~/.config/Code/User/settings.json
mkdir --parents ~/.config/Code/User &&
ln --force --relative --symbolic vscode/keybindings.json ~/.config/Code/User/keybindings.json &&
ln --force --relative --symbolic vscode/settings.json ~/.config/Code/User/settings.json
;;
vscode-win)
(cmd.exe /c del "%APPDATA%\Code\User\keybindings.json" 2\> nul; cmd.exe /c mklink "%APPDATA%\Code\User\keybindings.json" "$root_win\vscode\keybindings.json") &&
@ -84,32 +84,32 @@ while :; do
bash/scripts/2path.sh ~/.volta/bin
;;
nodejs-npmrc)
ln -frs nodejs/.npmrc ~/.npmrc
ln --force --relative --symbolic nodejs/.npmrc ~/.npmrc
;;
nodejs-config)
mkdir -p ~/dev &&
mkdir --parents ~/dev &&
for file in nodejs/config/{.*,*}; do
[[ "$file" == */. ]] || [[ "$file" == */.. ]] || ln -frs "$file" ~/dev/"$(basename "$file")"
[[ "$file" == */. ]] || [[ "$file" == */.. ]] || ln --force --relative --symbolic "$file" ~/dev/"$(basename "$file")"
done
;;
nodejs-scripts)
bash/scripts/2path.sh nodejs/scripts
;;
gcloud)
([ -d ~/.bin/gcloud ] || (mkdir -p ~/.bin/gcloud && wget "$(curl -s https://cloud.google.com/sdk/docs/downloads-versioned-archives | grep -o 'https[^\"]*linux-x86_64.tar.gz')" -O- | tar xzC ~/.bin/gcloud --strip-components=1)) &&
([ -d ~/.bin/gcloud ] || (mkdir --parents ~/.bin/gcloud && wget "$(curl --silent https://cloud.google.com/sdk/docs/downloads-versioned-archives | grep --only-matching 'https[^\"]*linux-x86_64.tar.gz')" --output-document=- | tar --extract --directory ~/.bin/gcloud --gzip --strip-components=1)) &&
bash/scripts/2path.sh ~/.bin/gcloud/bin/gcloud
;;
gcloud-config)
mkdir -p ~/.config &&
rm -rf ~/.config/gcloud &&
ln -rs gcloud/config ~/.config/gcloud
mkdir --parents ~/.config &&
rm --force --recursive ~/.config/gcloud &&
ln --relative --symbolic gcloud/config ~/.config/gcloud
;;
tmux)
ln -frs tmux/.tmux.conf ~/.tmux.conf
ln --force --relative --symbolic tmux/.tmux.conf ~/.tmux.conf
;;
firefox-rebuild-win)
ls firefox/*+* | cut -c9- | while read config; do
truncate -s0 firefox/"$config"
ls firefox/*+* | cut --characters=9- | while read config; do
truncate --size=0 firefox/"$config"
IFS='+' read -a pieces <<< "$config"
for piece in "${pieces[@]}"; do
[ -f firefox/"$piece" ] && cat firefox/"$piece" >> firefox/"$config"
@ -123,7 +123,7 @@ while :; do
mapfile -t profiles < <(ls "$profile_dir")
profiles_args=()
for ((i=0; i < ${#profiles[@]}; i++)); do profiles_args[2*i]="${profiles[$i]}"; profiles_args[2*i+1]="${profiles[$i]}"; done
mapfile -t configs < <(ls firefox/*+* | cut -c9-)
mapfile -t configs < <(ls firefox/*+* | cut --characters=9-)
configs_args=()
for ((i=0; i < ${#configs[@]}; i++)); do configs_args[2*i]="${configs[$i]}"; configs_args[2*i+1]="${configs[$i]}"; done
while :; do
@ -131,7 +131,7 @@ while :; do
[ "$profile" = '' ] && break
config="$(whiptail --title "Link $profile to config" --menu '' 22 60 15 "${configs_args[@]}" --notags --default-item "$config" 3>&2 2>&1 1>&3-)"
[ "$config" = '' ] && break
rm -f "$profile_dir"/"$profile"/user.js
rm --force "$profile_dir"/"$profile"/user.js
cmd.exe /c mklink %APPDATA%\\Mozilla\\Firefox\\Profiles\\"$profile"\\user.js "$root_win"\\firefox\\"$config"
done
;;

@ -1,3 +1,3 @@
#!/bin/sh
git fetch --all -p
git branch -vv | awk '/: gone]/{print $1}' | xargs -r git branch -D
git fetch --all --prune
git branch --verbose --verbose | awk '/: gone]/{print $1}' | xargs --no-run-if-empty git branch --delete --force

@ -1,4 +1,4 @@
#!/bin/sh
set -e
set -o errexit
git diff HEAD --quiet
git filter-repo --force --refs ${1:-HEAD} --commit-callback 'commit.committer_date = commit.author_date'

@ -1,11 +1,11 @@
#!/bin/sh
git remote get-url origin > /dev/null || exit 1
git remote get-url fork > /dev/null || exit 1
main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | cut -c 21-)
git push -f fork $(git rev-list --max-parents=0 $main_branch):$main_branch
main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | cut --characters=21-)
git push --force fork $(git rev-list --max-parents=0 $main_branch):$main_branch
for branch in $(git ls-remote --heads origin | sed 's?.*refs/heads/??'); do
[ $branch != $main_branch ] && git push fork :$branch
done
for tag in $(git ls-remote --tags fork | sed 's?.*refs/tags/??' | grep -v '\^{}'); do
for tag in $(git ls-remote --tags fork | sed 's?.*refs/tags/??' | grep --invert-match '\^{}'); do
git push fork :$tag
done

@ -1,2 +1,2 @@
#!/bin/sh
git -c core.filemode diff -R | grep -E '^(diff|(old|new) mode)' | git apply
git -c core.filemode diff -R | grep --extended-regexp '^(diff|(old|new) mode)' | git apply

@ -2,5 +2,5 @@
if [ $# = 0 ]; then >&2 echo 'Arguments: <path to file>...'; exit 1; fi
for path in "$@"; do
datetime="$(cd "$(dirname "$path")" && git log -1 --format=%aI -- "$(basename "$path")")"
[ "$datetime" ] && touch -md "$datetime" "$path"
[ "$datetime" ] && touch --date="$datetime" -m "$path"
done

@ -1,2 +1,2 @@
#!/bin/sh
git branch --list 'pr/*' | xargs -r git branch -D
git branch --list 'pr/*' | xargs --no-run-if-empty git branch --delete --force

@ -1,4 +1,4 @@
#!/bin/sh
set -e
set -o errexit
git diff HEAD --quiet
git filter-repo --force --refs ${1:-HEAD} --commit-callback 'commit.author_email = commit.committer_email = b"'"$(git config --get user.email)"'"; commit.author_name = commit.committer_name = b"'"$(git config --get user.name)"'"'

@ -1,6 +1,6 @@
#!/bin/bash
[ $# != 1 ] && { >&2 echo 'Argument: <pull request id>'; exit 1; }
{ [[ "$(git remote get-url origin)" =~ [/@]github\.com[/:]([^/:]+)\/([^/]+)$ ]] && read branch remote < <(curl -s -H "Authorization: bearer $(echo url=https://github.com | git credential fill | sed -nE 's/password=(.*)/\1/p')" -X POST -d "{\"query\":\"{ repository(owner: \\\"${BASH_REMATCH[1]}\\\", name: \\\"${BASH_REMATCH[2]%.git}\\\") { pullRequest(number: $1) { headRef { name } headRepository { nameWithOwner } } } }\"}" https://api.github.com/graphql | cut -d'"' --output-delimiter=' https://github.com/' -f12,18); } ||
{ [[ "$(git remote get-url origin)" =~ [/@]github\.com[/:]([^/:]+)\/([^/]+)$ ]] && read branch remote < <(curl --data "{\"query\":\"{ repository(owner: \\\"${BASH_REMATCH[1]}\\\", name: \\\"${BASH_REMATCH[2]%.git}\\\") { pullRequest(number: $1) { headRef { name } headRepository { nameWithOwner } } } }\"}" --header "Authorization: bearer $(echo url=https://github.com | git credential fill | sed --quiet --regexp-extended 's/password=(.*)/\1/p')" --request POST --silent https://api.github.com/graphql | cut --delimiter='"' --fields=12,18 --output-delimiter=' https://github.com/'); } ||
{ >&2 echo Unrecognized origin.; exit 1; }
git fetch $remote $branch:pr/$1
git config branch.pr/$1.remote $remote

@ -1,7 +1,7 @@
#!/bin/sh
set -e
set -o errexit
if [ $# != 2 ]; then >&2 echo 'Arguments: <remote url> <destination.bundle>'; exit 1; fi
tmp_dir="$(mktemp -d)"
trap 'rm -rf "$tmp_dir"' EXIT
tmp_dir="$(mktemp --directory)"
trap 'rm --force --recursive "$tmp_dir"' EXIT
git clone --mirror "$1" "$tmp_dir"
git -C "$tmp_dir" bundle create "$(readlink -f "$2")" --all
git -C "$tmp_dir" bundle create "$(readlink --canonicalize "$2")" --all

@ -1,16 +1,16 @@
#!/bin/sh
set -e
set -o errexit
cd "$(git rev-parse --show-toplevel)"
pkg_tar="$(npm pack | tail -n 1)"
pkg_tar="$(npm pack | tail --lines=1)"
cp --preserve package.json package.json.bak
node -e '
node --eval='
const fs = require("fs");
const str = fs.readFileSync("package.json").toString();
const pkg = JSON.parse(str);
pkg.scripts && delete pkg.scripts.prepare;
fs.writeFileSync("package.json", JSON.stringify(pkg, null, str.match(/\n([\t ]+)/)?.[1] ?? "\t") + str.match(/\n?$/)[0]);
'
git rm --cached -rf .
tar tf "$pkg_tar" | cut -c 9- | xargs -d '\n' git add -f
git rm --cached --force -r .
tar --list --file "$pkg_tar" | cut --characters=9- | xargs --delimiter='\n' git add --force
rm "$pkg_tar"
mv -f package.json.bak package.json
mv --force package.json.bak package.json

@ -1,13 +1,13 @@
#!/bin/sh
set -e
set -o errexit
if [ -z "$1" ]; then
git commit -n -q --allow-empty --author '_ <>' -m '_'
git -c core.filemode add -A
git commit -n -q --allow-empty --author '_ <>' -m '_'
git commit --allow-empty --author '_ <>' --message '_' --no-verify --quiet
git -c core.filemode add --all
git commit --allow-empty --author '_ <>' --message '_' --no-verify --quiet
git rev-parse HEAD
else
git reset -q --hard "$1" --
git clean -q -f -d
git reset --hard --quiet "$1" --
git clean -d --force --quiet
fi
git reset -q HEAD^ --
git reset -q --soft HEAD^ --
git reset --quiet HEAD^ --
git reset --quiet --soft HEAD^ --

@ -1,2 +1,2 @@
#!/bin/sh
"$(dirname "$(readlink -e "$0")")"/cmd/git.exe credential-manager-core "$@"
"$(dirname "$(readlink --canonicalize "$0")")"/cmd/git.exe credential-manager-core "$@"

@ -2,7 +2,7 @@
if [ $# = 0 ]; then >&2 echo 'Arguments: <executable file>...'; exit 1; fi
for bin in "$@"; do
(while :; do
if [ -f node_modules/.bin/"$bin" ]; then >&2 echo Found $bin; echo alias $bin=$(realpath -e node_modules/.bin)/"$bin"; break; fi
if [ -f node_modules/.bin/"$bin" ]; then >&2 echo Found $bin; echo alias $bin=$(readlink --canonicalize node_modules/.bin)/$bin; break; fi
if [ "$PWD" = / ]; then >&2 echo Could not find $bin; break; fi
cd ..
done)

@ -1,10 +1,10 @@
#!/bin/sh
set -e
set -o errexit
cd "$(git rev-parse --show-toplevel)"
pkg_ver="$(node -e 'console.log(require("./package.json").version)')"
git rev-parse --verify -q "refs/tags/v$pkg_ver" && exit 1
git diff --cached --quiet || git commit -nm "version $pkg_ver"
pkg_ver="$(node --eval='console.log(require("./package.json").version)')"
git rev-parse --quiet --verify "refs/tags/v$pkg_ver" && exit 1
git diff --cached --quiet || git commit --message="version $pkg_ver" --no-verify
git npm-add
git commit -nm "version $pkg_ver (release)"
git tag "v$pkg_ver" -am ""
git commit --message="version $pkg_ver (release)" --no-verify
git tag --annotate --message='' "v$pkg_ver"
git reset HEAD^

@ -8,8 +8,8 @@ for pkg in "$@"; do
while :; do
if [ -d "$base" ]; then
echo "$dest -> $PWD/$base"
rm -rf "$dest"
ln -rs "$base" "$dest"
rm --force --recursive "$dest"
ln --relative --symbolic "$base" "$dest"
break
fi
if [ "$PWD" = / ]; then >&2 echo Could not find source of $pkg; break; fi

@ -1,36 +1,36 @@
# use 256 color mode in terminals
set -g default-terminal 'screen-256color'
set-option -g default-terminal 'screen-256color'
# set prefix to ctrl-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
unbind-key C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# switch windows with ctrl-alt-arrows
bind -n C-M-Left select-window -p
bind -n C-M-Right select-window -n
bind-key -n C-M-Left select-window -p
bind-key -n C-M-Right select-window -n
# switch panes with alt-arrows
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind-key -n M-Left select-pane -L
bind-key -n M-Right select-pane -R
bind-key -n M-Up select-pane -U
bind-key -n M-Down select-pane -D
# split panes with ctrl-a | and ctrl-a -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
bind-key | split-window -h
bind-key - split-window -v
unbind-key '"'
unbind-key %
# reload config with ctrl-a shift-r
bind R source ~/.tmux.conf
bind-key R source ~/.tmux.conf
# enable mouse controls
set -g mouse on
set-option -g mouse on

@ -4,5 +4,5 @@ echo Arguments: ^<filesystem.tar.gz^> ^<destination directory^> ^<distribution n
exit /b 1
:run
wsl.exe --import %~3 "%~2" "%~1" --version 2
wsl.exe -d %~3 -- adduser %~4; adduser %~4 sudo; echo $'[automount]\n\toptions = metadata\n[network]\n\tgenerateHosts = false\n\tgenerateResolvConf = false\n[user]\n\tdefault = %~4' ^> /etc/wsl.conf; chmod 644 /etc/wsl.conf
wsl.exe --distribution %~3 -- adduser %~4; adduser %~4 sudo; echo $'[automount]\n\toptions = metadata\n[network]\n\tgenerateHosts = false\n\tgenerateResolvConf = false\n[user]\n\tdefault = %~4' ^> /etc/wsl.conf; chmod 644 /etc/wsl.conf
wsl.exe --terminate %~3

@ -1,9 +1,9 @@
#!/bin/bash
ps=$'set-psdebug -trace 1\r\nnetsh interface portproxy reset\r\nnetsh advfirewall firewall delete rule name=wsl-expose-ports\r\n'
for port in "$@"; do
: ${WSL_GUEST_IP:=$(ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')}
: ${WSL_GUEST_IP:=$(ip addr show eth0 | grep --only-matching --perl-regexp '(?<=inet\s)\d+(\.\d+){3}')}
ps+="netsh interface portproxy add v4tov4 listenport=${port/:*} listenaddress=0.0.0.0 connectport=${port/*:} connectaddress=${WSL_GUEST_IP}"$'\r\n'
ps+="netsh advfirewall firewall add rule name=wsl-expose-ports dir=in action=allow protocol=tcp localport=${port/:*}"$'\r\n'
done
ps+=pause
powershell.exe start powershell \"-enc\",\"$(echo -n "$ps" | iconv -t utf-16le | base64 -w 0)\" -verb runas
powershell.exe start powershell \"-enc\",\"$(echo -n "$ps" | iconv --to-code=utf-16le | base64 --wrap=0)\" -verb runas

@ -1,3 +1,3 @@
#!/bin/sh
. wsl-elevate
hwclock -s
hwclock --hctosys

@ -1,4 +1,4 @@
(return 0 2>/dev/null) || { >&2 echo This script must be sourced, not run directly.; exit 1; }
for i in $(pstree -np -s $$ | grep -o -E '[0-9]+'); do
for i in $(pstree --numeric-sort --show-parents --show-pids $$ | grep --extended-regexp --only-matching '[0-9]+'); do
[ -e /run/WSL/${i}_interop ] && export WSL_INTEROP=/run/WSL/${i}_interop
done

@ -1,2 +1,2 @@
(return 0 2>/dev/null) || { >&2 echo This script must be sourced, not run directly.; exit 1; }
[ $(id -u) = 0 ] || { wsl.exe -d $WSL_DISTRO_NAME -u $(id -un 0) -- "$0" "$@"; exit; }
[ $(id --user) = 0 ] || { wsl.exe --distribution $WSL_DISTRO_NAME --user $(id --name --user 0) -- "$0" "$@"; exit; }

Loading…
Cancel
Save