I recently upgraded from CentOS 5.8 (with GNU bash 3.2.25) to CentOS 6.5 (with GNU bash 4.1.2). The team that used to work with CentOS 5.8 no longer works with CentOS 6.5. This is a stupid example with a light workaround, but I'm trying to figure out what happens under the hood of bash, which causes different behavior. Maybe this is a new bug in bash 4.1.2 or an old bug that has been fixed and new behavior is expected?
CentOS 5.8:
(echo "hi" > /dev/stdout) > test.txt
echo $?
0
cat test.txt
hi
CentOS 6.5:
(echo "hi" > /dev/stdout) > test.txt
-bash: /dev/stdout: Not a directory
echo $?
1
Update: this seems to be a problem with the CentOS version. I have another CentOS 6.5 machine in which the team works. I removed any environment variables as the culprit. Any ideas? On all machines, these commands produce the same output:
ls -ld /dev/stdout
lrwxrwxrwx 1 root root 15 Apr 30 13:30 /dev/stdout -> /proc/self/fd/1
ls -lL /dev/stdout
crw--w---- 1 user1 tty 136, 0 Oct 28 23:21 /dev/stdout
. , stdout . , , , , bash?
:
((ls -la /dev/stdout; ls -la /proc/self/fd/1) >/dev/stdout) > test.txt
cat test.txt
lrwxrwxrwx 1 root root 15 Aug 13 08:14 /dev/stdout -> /proc/self/fd/1
l-wx------ 1 user1 aladdin 64 Oct 29 06:54 /proc/self/fd/1 -> /home/user1/test.txt
, , /tmp . isilon NAS /home mount, , , , . /dev/stdout, , .
: NFS v4 v3. v3 .