I frequently work on the Windows command line within ConEmu and occasionally, after working in a given window for some time, get the following unexpected error:
ELSE was unexpected at this time.
Currently, it occurred after pasting about 150 lines of rm
commands (may be unrelated).
Once I get that error, I cannot use the ELSE
statement in that window; I must start a new shell process, at which point my scripts work as expected. For example, once that error occurs in a window, I observe the following:
C:\> IF DEFINED AN_ENV_VAR (ECHO YES) ELSE ECHO NO
ELSE was unexpected at this time.
C:\> IF NOT DEFINED AN_ENV_VAR (ECHO YES) ELSE ECHO NO
ELSE was unexpected at this time.
C:\> IF DEFINED AN_ENV_VAR (ECHO YES)
C:\> IF NOT DEFINED AN_ENV_VAR (ECHO YES)
YES
A new shell gives expected results:
C:\> IF DEFINED AN_ENV_VAR (ECHO YES) ELSE ECHO NO
NO
C:\> IF NOT DEFINED AN_ENV_VAR (ECHO YES) ELSE ECHO NO
YES
C:\> IF DEFINED AN_ENV_VAR (ECHO YES)
C:\> IF NOT DEFINED AN_ENV_VAR (ECHO YES)
YES
Is there any way to fix the current shell?
Aucun commentaire:
Enregistrer un commentaire