env-share: added git-bash companion script

This commit is contained in:
Valerie Wolfe 2024-07-08 13:09:51 -04:00
parent cceb2048b9
commit 2798682a1d
3 changed files with 25 additions and 1 deletions

View file

@ -4,6 +4,11 @@
These are tools I use to use Windows primarily through WSL. A lot of them These are tools I use to use Windows primarily through WSL. A lot of them
assume you have PowerShell somewhere in your `PATH` as "`pwsh`". assume you have PowerShell somewhere in your `PATH` as "`pwsh`".
## `env-share`
A hacked-together utility for sending WSL variables back to Windows
shells. The utility runs in WSL, and companion scripts run in Windows.
## `mkwin` ## `mkwin`
A Linux utility to quickly make a bash script to run a Windows executable with A Linux utility to quickly make a bash script to run a Windows executable with

View file

@ -0,0 +1,19 @@
#!/usr/bin/bash
# make sure file is present
file=$ENV_SHARE_FILE
if [[ ! -r "$file" ]]; then
return
fi
# read lines and set variables
IFS=' = '
while read line; do
var=${line%$IFS*}
value=${line#*$IFS}
export $var=$value
done <$file
# delete file
rm $file

View file

@ -9,7 +9,7 @@
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Nm .Nm
utility writes environment variables to a file to be loaded by a script in the target process. utility writes environment variables to a file to be loaded by a companion script in the target process.
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width Ds .Bl -tag -width Ds
.It Ev ENV_SHARE_FILE .It Ev ENV_SHARE_FILE