ubuntu-wsl2-systemd-script
ubuntu-wsl2-systemd-script copied to clipboard
all bash scripts spawn new interactive session
When I run a script with a shebang like #!/usr/bin/env bash or #!/bin/bash, bash is started in interactive mode (so I get a prompt and the script doesn't run).
in the setup script this line: sudo sed -i 2a"# Start or enter a PID namespace in WSL2\nsource /usr/sbin/start-systemd-namespace\n" /etc/bash.bashrc might be the culprit. It puts the source line above the line that exits for noninteractive stuff (i.e. [ -z "$PS1" ] && return). I moved the source line below the noninteractive stuff and things seem to work again.
I think this issue is caused by these scripts.
I also use zsh by default (via chsh)
PS. I realise this isn't likely to be patched as mentioned in the readme, but wanted to put this here in case it helps someone.