dash supposedly implements test s1 < s2 and test s1 > s2 for string comparisons. A cursory glance at [0], [1] and [2] seems to confirm this. Anyway the shell redirection seems to take precedence so that the test is not actually performed. $ type test test is a shell builtin $ ls -l bar ls: cannot access 'bar': No such file or directory $ test "foo" < "bar" dash: 2: cannot open bar: No such file $ test "foo" > "bar" $ ls -l bar -rw-r--r-- 1 gpiero gpiero 0 Sep 2 12:51 bar As a side note, '<' and '>' are not mandated by POSIX [3]. Thanks, Gian Piero. [0] https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/dash.1 [1] https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/bltin/test.1 [2] https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/bltin/test.c (STRLT and STRGT) [3] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
severity 1051076 grave thanks Thinking about it, grave seems a more appropriate severity as the issue could cause data loss in case s2 happens to be the pathname of an existent file when using the form `test s1 > s2`.
Control: severity -1 normal Control: tag -1 wontfix You forgot to escape the < and >: $ test foo '>' bar $ echo $? 0 $ test foo '<' bar $ echo $? 1