summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-03-13 22:53:17 +0000
committerjilles <jilles@FreeBSD.org>2010-03-13 22:53:17 +0000
commit6be35ddc1a8fedc3f7f37d3b88f55fc51dd67b33 (patch)
treeef897b5710102607555e0af7bc23332d695b90ab /tools
parenta93ba965a77aac461c3f200b2c61ffd75cfaf937 (diff)
downloadFreeBSD-src-6be35ddc1a8fedc3f7f37d3b88f55fc51dd67b33.zip
FreeBSD-src-6be35ddc1a8fedc3f7f37d3b88f55fc51dd67b33.tar.gz
sh: Do not abort on a redirection error if there is no command word.
Although simple commands without a command word (only assignments and/or redirections) are much like special builtins, POSIX and most shells seem to agree that redirection errors should not abort the shell in this case. Of course, the assignments persist and assignment errors are fatal. To get the old behaviour portably, use the ':' special builtin. To get the new behaviour portably, given that there are no assignments, use the 'true' regular builtin.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/errors/redirection-error4.07
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/errors/redirection-error4.0 b/tools/regression/bin/sh/errors/redirection-error4.0
new file mode 100644
index 0000000..2060974
--- /dev/null
+++ b/tools/regression/bin/sh/errors/redirection-error4.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+# A redirection error should not abort the shell if there is no command word.
+exec 2>/dev/null
+</var/empty/x
+</var/empty/x y=2
+y=2 </var/empty/x
+exit 0
OpenPOWER on IntegriCloud