Link to home
Start Free TrialLog in
Avatar of partiallynothing
partiallynothing

asked on

Batch to Bash

I would like to translate this to a bash script.

The current Windows batch script is:

@ECHO OFF
:LOOP
CLS
ECHO AP Biology Lab Selector
ECHO -----------------------
ECHO Lab 2: Enzyme Catalysis
ECHO Q to Quit
ECHO.
:: SET /P prompts for input and sets the variable
:: to whatever the user types
SET Choice=
SET /P Choice=Type lab number:
:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
ECHO.
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='2' GOTO Item1
IF /I '%Choice%'=='Q' GOTO End
IF /I '%Choice%'=='Quit' GOTO End
ECHO "%Choice%" is not valid!
PAUSE
ECHO.
GOTO Loop
:Item1
CLS
ECHO Starting program...
::do stuff
GOTO Again
:Again
CLS
GOTO Loop
:End

Any help would be great.
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial