[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about behavior of redirections inside an if construct
From: |
Thomas Schwinge |
Subject: |
Question about behavior of redirections inside an if construct |
Date: |
Thu, 29 Jan 2009 16:53:50 +0100 |
User-agent: |
Mutt/1.5.11 |
Hello!
I'm probably only missing something very obvious, but...
thomas@dirichlet:~ $ bash --version
GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
thomas@dirichlet:~ $ bash -c 'if { :; } 2> /dev/null < NONEXISTING_FILE;
then :; else echo >&2 OK; fi'
OK
thomas@dirichlet:~ $ sh -c 'if { :; } 2> /dev/null < NONEXISTING_FILE; then
:; else echo >&2 OK; fi'
OK
thomas@dirichlet:~ $ bash -c 'if : 2> /dev/null < NONEXISTING_FILE; then :;
else echo >&2 OK; fi'
OK
These three work as expected. But why doesn't the following one?
thomas@dirichlet:~ $ sh -c 'if : 2> /dev/null < NONEXISTING_FILE; then :;
else echo >&2 OK; fi'
(no output)
Regards,
Thomas
signature.asc
Description: Digital signature
- Question about behavior of redirections inside an if construct,
Thomas Schwinge <=