paul@UMIX.CC.UMICH.EDU ('da Kingfish) (06/25/86)
is this just me, or what?? ***** % cat /tmp/test.sh #!/bin/sh if [ '!' -f $1 ] then echo "Hmmmmm. can't open $1" else echo "Great. can open $1" fi exit 0 % /tmp/test.sh /etc/passwd Great. can open /etc/passwd % /tmp/test.sh /dev/null Hmmmmm. can't open /dev/null % cp /dev/null xxx % ls -l xxx -rwx------ 1 paul 0 Jun 25 12:11 xxx % ls -lL /dev/null crwxrwxrwx 1 <none> 0, 0 Feb 26 20:14 /dev/null ***** this kind of check happens in /usr/bin/install, and i "install -c /dev/null blah" to make sure files are empty. except i can't.
rees@apollo.UUCP (Jim Rees) (06/26/86)
% /tmp/test.sh /etc/passwd Great. can open /etc/passwd % /tmp/test.sh /dev/null Hmmmmm. can't open /dev/null This is apparently correct behavior for sysV, and the code somehow crept over the wall and infected the bsd4.2 '[' (which is builtin to /bin/sh; a vestigial remnant of less prosperous days). The (non-builtin) 'test' command seems to work correctly. Maybe the easiest fix is to have 'install' use 'test' instead of '['. In fact, this even works, provided you have a /bin/[ (linked to 'test'): #!/bin/sh if /bin/[ '!' -f $1 ] then echo "Hmmmmm. can't open $1" else echo "Great. can open $1" fi exit 0 -------