I tried to set environment variables for my Visual Studio Code tasks that will run in my Windows Subsystem Linux. However, it does not seem to work. Here is my tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "test env",
"type": "shell",
"command": "echo",
"args": [
"$test"
],
"options": {
"env": {
"test": "test_string"
}
}
},
]
}
The output is:
> Executing task in folder ex12-test: echo $test <
Terminal will be reused by tasks, press any key to close it.
Note that by default shell has been manually modified to C:\WINDOWS\SysNative\bash.exe
for WSL, as recommended here and here.