tcsh can't search endif correctly if no space before "then"
Issue
- tcsh can't search endif correctly if no space before "then".
- Please refer to the following reproducer. After processing then-block(line 3) and finding else-statement(line 4), tcsh should jump to next line of the same level endif in line 9.
- However, tcsh fails to find proper endif(line 9) if space before then-statement in line 5 is omitted, then jumps to next line of endif in line 7.
Reproducer
1 #!/bin/tcsh -f
2 if (1 == 1) then
3 echo 1
4 else
5 if (2 == 2)then # <== no space before "then"
6 echo 2
7 endif
8 echo "This message should not be shown"
9 endif
Actual Result:
[root@rhel6 ~]# ./test.csh
1
This message should not be shown
[root@rhel6 ~]#
Environment
- Red Hat Enterprise Linux 6
- tcsh-6.17-25.el6_6.x86_64 and earlier
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.