[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: <> redirection and notations



> but /bin/sh on all machines i've tried here require that the file exist,  
> therefore do not use O_CREAT.  this is consistent with them being Bourne  
> shells and predating the existence of the O_CREAT flag.

Looking at /bin/sh with strace reveals that sh is trying to open the
file O_RDONLY, so it's not even doing the right thing.

	...
read(19, "exec 4<>/tmp/there\n", 128) = 19
open("/tmp/there", RDONLY, 0) = 3
fcntl(4, GETFD, 0) = -1 (Bad file number)
close(4) = -1 (Bad file number)
fcntl(3, DUPFD, 0x4) = 4
close(3) = 0
	...

Chet


--
``The ballpark is quiet now, save for the sound of droplets landing.  That
  is as it should be.  For today there are two fewer boys of summer.''

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu