hokuto100retsuken / dotfiles

0 stars 0 forks source link

WSL2かどうか判定したい #4

Open hokuto100retsuken opened 1 year ago

hokuto100retsuken commented 1 year ago
#!/bin/bash

# WSL環境かどうかを判定する
if [ -n "$WSL_DISTRO_NAME" ] || [ -f "/run/WSL/4.0/microsoft-standard" ]; then
  echo "This is Ubuntu running on WSL2."
else
  echo "This is Ubuntu running on bare metal."
fi

これでできるとか?