How to run Shell scripts in Windows
Training machine learning or deep learning models can be automated by using shell scripts in Linux-based PCs. Can we run the same shell scripts on Windows without changing a line of code?
YES, we can. But that will require a bit of work.
1. Using bash on Windows to run Shell scripts
Installing Cygwin, MinGW, or Git Bash on Windows and adding the path where it is installed to the Environment variables will allow us to run “.sh” files on Windows from Command Prompt.
2. Converting “.sh” file to “.bat” file
“.bat” extensions are used for batch scripts, which are also used to automate tasks on Windows. Commands for Shell scripting and Batch scripting are not exactly the same, but commands from shell scripts can be converted for like-to-like commands in batch scripts.
A simple converter can be found here: https://daniel-sc.github.io/bash-shell-to-bat-converter/
However, this tool does not support converting loop conversion from shell to batch. Any user can do so by studying the tutorials given below:
- https://www.section.io/engineering-education/dive-into-batch-scripting-language/
- https://en.wikibooks.org/wiki/Windows_Batch_Scripting
- https://www.youtube.com/playlist?list=PL8WTXLSrtyWrQ5Tl50zkTeRc3bATyHRbX
- https://www.youtube.com/playlist?list=PL69BE3BF7D0BB69C4
Tutorials for Shell scripting: