I noticed that Windows 7 allows you to execute .sh files as if they were .bat files. This made me wonder if the .sh file could be written in such a way that it could be run on Windows and Linux (say bash).
The first thing that comes to my mind is to fabricate an if-expression so that Windows and Ubuntu can handle it and go to the appropriate block to execute platform-specific commands. How can I do that?
Note. I know this is not a good practice. I also know that scripting languages ββsuch as Python are much better suited to solve this problem than the command line mixed script syntax. I'm just curious...
source share