Skip to content

Instantly share code, notes, and snippets.

@xopr
Created September 27, 2018 13:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xopr/bc6f4f2827d911457789af1f744e0e75 to your computer and use it in GitHub Desktop.
Save xopr/bc6f4f2827d911457789af1f744e0e75 to your computer and use it in GitHub Desktop.
batch bash hybrid script
:<<"::CMDLITERAL"
@ECHO OFF
echo Welcome to %COMSPEC%
GOTO :CMDSCRIPT
::CMDLITERAL
echo "Welcome to ${SHELL}"
function REM {
# REM is used to execute linux shell code
eval $*
}
function call {
# Do not do anything; call is for windows batch files
:
}
# Note the space
: CMDSCRIPT
call echo This will be displayed in windows command prompt
REM echo This will be displayed in linux shell prompt
echo This will be displayed on both systems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment