de en

Thorsten Reimers

Bash- and Batch-Script

Sep 3, 2023

Ich found a Github project for Violet-UML that shows a start script runnable under Linux and also under Windows.

This is awesome but the script was very sophisticated when it came to line breaks and gave error messages in both operating systems.

I found the following instruction after short research that looked really promising. Here my first try:

test.bat

:<<"::cmdliteral"
@echo off
goto :cmdscript
::cmdliteral

echo "Executing Linux Bash script ..."
exit 0

:cmdscript
echo Executing Windows Batch script ...

That gave the results below when executing

c:\>test.bat
Executing Windows Batch script ...

and

$ ./test.bat 
Executing Linux Bash script ...

Wow, this is really awesome!