GNU bug report logs -
#59612
29.0.50; Eshell: The behavior of conditionals depends on whitespace
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
The script I provided has a mis-typed comment on line 6. The script should
be:
################################################################
# The behavior of conditionals depends on whitespace
# Source this script to test it
# This formatting works as expected; evaluates the "true" block.
# Result:
# "It is 2" # <=== The original had a typo here, included NOT
#
if { = 2 2 } {
echo "It is 2"
} {
echo "It is NOT 2"
}
# This formatting causes a BUG: both the "true" block and the "false" block
are evaluated.
# I tried several combinations, it appears it the "false" block starts on
it's own line,
# it is no longer treated a part of the "if" expression. Which could be
argued
# is expected because there is no "else" that would define whether the
second block
# is not part of the "if" expression. BUT see next test
#
# Result:
# "It is 3"
# "It is NOT 3"
#
if { = 3 3 } {
echo "It is 3"
}
{
echo "It is NOT 3"
}
# BUT we get the same incorrect result if we place the whole if expression
into {}
{
if { = 4 4 } {
echo "It is 4"
}
{
echo "It is NOT 4"
}
}
######################################################################
[Message part 2 (text/html, inline)]
This bug report was last modified 2 years and 246 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.