Shell Script (.sh) คือไฟล์สคริปต์ของ Linux/Unix สามารถรันบน Windows ได้ 2 วิธีหลัก:
1. ใช้ WSL (Windows Subsystem for Linux) - แนะนำ
- Settings > Update & Security > For Developers > เปิด Developer Mode
- ค้นหา "Turn Windows features on or off" > ติ๊ก Windows Subsystem for Linux > Restart
- เปิด Command Prompt/PowerShell > พิมพ์
bashเข้าสู่ Bash - ไปที่โฟลเดอร์ไฟล์ .sh > รัน
bash script-filename.sh
2. ใช้ Ubuntu บน Windows (Microsoft Store)
- ติดตั้ง Ubuntu จาก Microsoft Store
- เปิด Ubuntu > ไปที่โฟลเดอร์ไฟล์ (Windows drives อยู่ที่
/mnt/c/) - รัน
sh script.shหรือbash script.sh
หมายเหตุ: WSL เพียงพอสำหรับสคริปต์ส่วนใหญ่ หากต้องการ Kernel จริง ให้ใช้ Ubuntu/WSL 2