0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Windowsからダブルクリックでshファイル実行

Posted at

sample.sh.bat

:; if !(type uname > /dev/null 2>&1); then
    @ECHO off
    wsl ./%~n0%~x0
    PAUSE
    EXIT
:; fi
# ===== ↑ Windows bat =====

# ===== ↓ Linux bash =====
echo `uname`
  • sh実行のために起動用batファイルは作りたくなかった
  • :;を使うことでsh側でのみ実行するコマンドを書けるっぽい
  • bat側で動くコマンドとsh側で動くコマンドを分け、batで動いてる場合はwslで自分自身を実行させる
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?