* Марк Коренберг <socketpair@xxxxxxxxx> [2014-01-28 13:16]: > $ dpkg -l | fgrep dash > ii dash 0.5.7-2ubuntu2 > POSIX-compliant shell > > $ exec 9<no_such_file && echo TEST > dash: 1: cannot open no_such_file: No such file > > $ exec 9<no_such_file || echo TEST > dash: 2: cannot open no_such_file: No such file > > So, I cannot test this operation without using $? No, exec is a special built in and POSIX specifies that ...if a redirection error occurs (see Consequences of Shell Errors), the shell shall exit with a value in the range 1-125 dash correctly exits with exit status of 2 as it should. ksh93, mksh, and pdksh do the same. > in BASH this works as expected (even in sh mode) That's either a bug or an intended deviation from the POSIX standard, you'll have to ask on the bug-bash list about that. -- Guido Berhoerster -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html