On Thu, Apr 19, 2018 at 08:24:43PM +0200, Vincent Lefevre wrote: > On 2018-04-17 14:28:17 -0500, Derek Martin wrote: > > One wonders what systems these are, and whether this is even worth > > considering. If it is, I believe Bourne shell allows compound tests > > like the following: > > > > [ -f $file -o -d $file ] > > AFAIK, -o is not portable and has been marked obsolescent. > You should write: > > [ -f "$file" ] || [ -d "$file" ]
Sure, I have no issue with writing it that way... it's probably slighly less efficient, but whether it is or isn't is not interesting here. I have doubts about the "not portable" comment though... AFAICT it's currently supported by Bourne, Korn, Bash, and all POSIX-compliant shells. I'm not sure where it wouldn't port to, other than to shells which don't have Bourne-like syntax in the first place. Arguing that the syntax is obsolete, when the point is to support an entire shell that is obsolete, seems redundant. But I think since both versions of the syntax should be well supported it's purely academic. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -=-=-=-=- This message is posted from an invalid address. Replying to it will result in undeliverable mail due to spam prevention. Sorry for the inconvenience.
pgpeQw2u4cdBj.pgp
Description: PGP signature