Skip to content

Instantly share code, notes, and snippets.

@secretsquirrel
Created December 7, 2017 19:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secretsquirrel/b425e8490bc2dfcbf1f9f69f065ecc84 to your computer and use it in GitHub Desktop.
Save secretsquirrel/b425e8490bc2dfcbf1f9f69f065ecc84 to your computer and use it in GitHub Desktop.
bash|batch
cat /tmp/test.sh
:; if [ -z 0 ]; then
@echo off
goto :WINDOWS
fi
if [ -z "$2" ]; then
echo "usage: $0 <firstArg> <secondArg>"
exit 1
fi
# bash stuff
echo moo
exit
:WINDOWS
if [%2]==[] (
SETLOCAL enabledelayedexpansion
set usage="usage: %0 <firstArg> <secondArg>"
@echo !usage:"=!
exit /b 1
)
:: windows stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment