![]() |
![]() |
#1 |
Posts: 25,461
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Basic shell scripting
I am currently in a couple programming classes and have zero experience in programming, but pretty good elsewhere. We are given a step by step example from the book and I have actually copied and pasted the code. The issue I am coming across is when I force an error to try to get the appropriate error response, I get "is was unexpected at this time". The actual program will work all except giving the appropriate error msg.
@ECHO off TITLE "KnockKnock1.bat - Tried and true, but still funny!" COLOR 0E CLS ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. SET /p reply="Knock Knock! C:>" CLS IF NOT %reply% == "Who is there?" ( ECHO "Sorry, you need to use quotes around your reply please." GOTO :EOF ) ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. SET /p reply="Orange! C:>" CLS IF NOT %reply% == "Orange who?" ( ECHO "Sorry, you need to use quotes around your reply please." GOTO :EOF ) ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO "Orange you glad you've written your first Windows shells script?" ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. ECHO. |
![]() |