Additions:
FILE1 and FILE2 have the same canonical path
====Sequences====
XDM Sequences are evaluated as "Effective Boolean" but only if they appear as a single value. This can cause runtime
errors if you dont know ahead of time if a sequence is 0,1 or more.
Example:
The following is evalutated according to the [http://www.w3.org/TR/xpath20/#id-ebv Effective Boolean] rule of XPath.
In this case a sequence of non atomic elements of 1 or more is "true"
x=<[ <foo/> ]> # XML sequence of 1
[ $x ] && echo true
One might expect this also to work
x=<[ <foo/> , <bar/> ]>
[ $x ] && echo true
Results in
**{{color fg="#FF0000" text="[:Unexpected xml value operator"}} **
The problem is that $x is expanded in command mode and evaluates to 2 arguments not one. The resulting expression is equivalent to
[ <foo/> <bar/> ] && echo true
Which the ""["" command doesnt expect. To get the desired results either wrap the expression in an XQuery expression and XPath expression that evaluates to an atomic, like exists()
or quote the variable with {} which prevents expansion into multple words, preserving the value as a single arugment of type sequence.
Either of these will work
x=<[ <foo/> , <bar/> ]>
[ <[ exists( $x ) ]> ] && echo true
x=<[ <foo/> , <bar/> ]>
[ {$x} ] && echo true
Be aware that the former expression only returns true if $x is not empty, wheras the later uses the [http://www.w3.org/TR/xpath20/#id-ebv Effective Boolean] rules.
For example the following test evaluates false even though the list is not empty
x=<[ fn:false() ]>
[ {$x} ] && echo This will not echo
if you really want to tell if a list is empty use the former version or equivilent (such as ""count($x) gt 0)"" ) or use the variable sequence count expression
[ ${#x} -ne 0 ] && echo The list is not empty
You can also convert the result to a string and compare for empty using -n or -z. For XML expressions the string serialization rules will be used which
does not always produce a non empty string for sequences (such as attributes) and can also produce very large strings which are inefficient to serialize.
Examples:
x=<[ <foo a=""/>/@a ]>
echo \$x is "$x" count ${#x}
[ -z "$x" ] && echo true || echo false
y=<[ $x/string() ]>
echo \$y is "$y" count ${#y}
[ -z "$y" ] && echo true || echo false
Result
$x is a="" count 1
false
$y is count 1
true
This is because $x is an attribute node that when implicitly serialized produces a="" but when explicitly converted to a string using the string() function produces "" (an empty string)
[[ CategoryCommands]]
====Sequences====
XDM Sequences are evaluated as "Effective Boolean" but only if they appear as a single value. This can cause runtime
errors if you dont know ahead of time if a sequence is 0,1 or more.
Example:
The following is evalutated according to the [http://www.w3.org/TR/xpath20/#id-ebv Effective Boolean] rule of XPath.
In this case a sequence of non atomic elements of 1 or more is "true"
x=<[ <foo/> ]> # XML sequence of 1
[ $x ] && echo true
One might expect this also to work
x=<[ <foo/> , <bar/> ]>
[ $x ] && echo true
Results in
**{{color fg="#FF0000" text="[:Unexpected xml value operator"}} **
The problem is that $x is expanded in command mode and evaluates to 2 arguments not one. The resulting expression is equivalent to
[ <foo/> <bar/> ] && echo true
Which the ""["" command doesnt expect. To get the desired results either wrap the expression in an XQuery expression and XPath expression that evaluates to an atomic, like exists()
or quote the variable with {} which prevents expansion into multple words, preserving the value as a single arugment of type sequence.
Either of these will work
x=<[ <foo/> , <bar/> ]>
[ <[ exists( $x ) ]> ] && echo true
x=<[ <foo/> , <bar/> ]>
[ {$x} ] && echo true
Be aware that the former expression only returns true if $x is not empty, wheras the later uses the [http://www.w3.org/TR/xpath20/#id-ebv Effective Boolean] rules.
For example the following test evaluates false even though the list is not empty
x=<[ fn:false() ]>
[ {$x} ] && echo This will not echo
if you really want to tell if a list is empty use the former version or equivilent (such as ""count($x) gt 0)"" ) or use the variable sequence count expression
[ ${#x} -ne 0 ] && echo The list is not empty
You can also convert the result to a string and compare for empty using -n or -z. For XML expressions the string serialization rules will be used which
does not always produce a non empty string for sequences (such as attributes) and can also produce very large strings which are inefficient to serialize.
Examples:
x=<[ <foo a=""/>/@a ]>
echo \$x is "$x" count ${#x}
[ -z "$x" ] && echo true || echo false
y=<[ $x/string() ]>
echo \$y is "$y" count ${#y}
[ -z "$y" ] && echo true || echo false
Result
$x is a="" count 1
false
$y is count 1
true
This is because $x is an attribute node that when implicitly serialized produces a="" but when explicitly converted to a string using the string() function produces "" (an empty string)
[[ CategoryCommands]]
Deletions:
[[CategoryCommands]]
Additions:
**-D name**
true if the environment variable "name" is defined
true if the environment variable "name" is defined
Additions:
====XML Expressions====
An XML Expression within the test command is evaluated to boolean and the result used for the expression.
A simplistic example
%%
[ <[ fn:true() ]> ] && echo true
%%
A more interesting example
%%
a=<[ <foo attr="bar"/> ]>
if [ <[ $a/@attr eq 'bar' ]> ] ; then
echo attr is bar
fi
%%
Note the spaces needed before and after the [ and ]
An XML Expression within the test command is evaluated to boolean and the result used for the expression.
A simplistic example
%%
[ <[ fn:true() ]> ] && echo true
%%
A more interesting example
%%
a=<[ <foo attr="bar"/> ]>
if [ <[ $a/@attr eq 'bar' ]> ] ; then
echo attr is bar
fi
%%
Note the spaces needed before and after the [ and ]
Additions:
[[Commands]]
Deletions:
Additions:
TRUE if string is formated as an absolute URI (starts with <scheme>: )
Deletions:
Additions:
TRUE if string is formated as an absolute URI (starts with <scheme>:\/[/ )
Deletions:
No Differences
Additions:
**test** expr
**[** expr **]**
**[** expr **]**
Deletions:
*[* expr *]*
Additions:
======Command test======
======Synopsis======
*test* expr
*[* expr *]*
**-u string**
TRUE if string is formated as an absolute URI (starts with <scheme>:// )
======Synopsis======
*test* expr
*[* expr *]*
**-u string**
TRUE if string is formated as an absolute URI (starts with <scheme>:// )
Deletions:
======[ expr ]======
Additions:
[[CategoryCommands]]
Additions:
true if the value/argument is a string //type //(not an xml type)
true if the value/argument is an xml //type//
true if the value/argument is an xml //type//
Deletions:
true if the value/argument is an xml type
Additions:
**-S value**
true if the value/argument is a string (not an xml type)
**-X value**
true if the value/argument is an xml type
true if the value/argument is a string (not an xml type)
**-X value**
true if the value/argument is an xml type
Additions:
**-w FILE**
Deletions:
Additions:
**-f FILE**
**-r FILE**
**-s FILE**
**-x FILE**
**-r FILE**
**-s FILE**
**-x FILE**
Deletions:
-r FILE
-s FILE
-x FILE
Additions:
**EXPRESSION1 -a EXPRESSION2**
**EXPRESSION1 -o EXPRESSION2**
**-n STRING**
**STRING **
equivalent to -n STRING
**-z STRING**
**STRING1 = STRING2**
**STRING1 != STRING2**
**INTEGER1 -eq INTEGER2**
**INTEGER1 -ge INTEGER2**
**INTEGER1 -gt INTEGER2**
**INTEGER1 -le INTEGER2**
**INTEGER1 -lt INTEGER2**
**INTEGER1 -ne INTEGER2**
**FILE1 -ef FILE2**
**FILE1 -nt FILE2**
**FILE1 -ot FILE2**
**-d FILE**
**-e FILE**
**EXPRESSION1 -o EXPRESSION2**
**-n STRING**
**STRING **
equivalent to -n STRING
**-z STRING**
**STRING1 = STRING2**
**STRING1 != STRING2**
**INTEGER1 -eq INTEGER2**
**INTEGER1 -ge INTEGER2**
**INTEGER1 -gt INTEGER2**
**INTEGER1 -le INTEGER2**
**INTEGER1 -lt INTEGER2**
**INTEGER1 -ne INTEGER2**
**FILE1 -ef FILE2**
**FILE1 -nt FILE2**
**FILE1 -ot FILE2**
**-d FILE**
**-e FILE**
Deletions:
EXPRESSION1 -o EXPRESSION2
-n STRING
STRING equivalent to -n STRING
-z STRING
STRING1 = STRING2
STRING1 != STRING2
INTEGER1 -eq INTEGER2
INTEGER1 -ge INTEGER2
INTEGER1 -gt INTEGER2
INTEGER1 -le INTEGER2
INTEGER1 -lt INTEGER2
INTEGER1 -ne INTEGER2
FILE1 -ef FILE2
FILE1 -nt FILE2
FILE1 -ot FILE2
-d FILE
-e FILE
Additions:
**( EXPRESSION )**
**! EXPRESSION**
**! EXPRESSION**
Deletions:
! EXPRESSION
No Differences