How to write a bash script that will run on Windows and Linux

2k views Asked by At

I'm writing a bash script to be executed on both Windows and Linux machines from the terminal. One of the lines calls Rscript, a program for executing .R programs. The issue is that in Linux, the command is simply Rscipt, whereas in Windows, it is Rscript.exe. Is there any way to modify the program such that it'll run seamlessly on both Windows and Linux operating systems?

Thank you.

1

There are 1 answers

0
MUY Belgium On

You can name any Unix executable with suffix .exe, no problem too... the first bits in Linux are magic bits which indicates the real type of one file.

or

Simply use perl or python scripts, Perl and python can work both on Windows and Linux.