lcc.brian@UCLA-LOCUS.ARPA (Brian Horn) (05/22/85)
A while ago someone asked what the redirection syntax "<>" was for and whether it was useful. Since it didn't work, it certainly wasn't useful, however the fix below may be found to be useful (Note: this patch is for the bourne shell distributed with sysV release 2. It should be very similiar for other versions of sh.) sh/service.c (approx. line 65) . . . else if (iof & IOMOV) { if (eq(minus, ion)) { fd = -1; close(ioufd); } else if ((fd = stoi(ion)) >= USERIO) failed(ion, badfile); else fd = dup(fd); } + else if (iof & IORDW) { + if ((fd = open(ion, 2)) < 0) + failed(ion, badopen); + } else if ((iof & IOPUT) == 0) fd = chkopen(ion); . . . This patch will open the file after the "<>" read/write defaulting to file descriptor 0. (Of course, as with all sh redirection you may proceed it with a file descriptor number.) Brian D. Horn Locus Computing Corporation lcc!brian@ucla-cs {ucivax,trwrb}!lcc!brian {ihnp4,randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!brian