Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!decwrl!labrea!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.unix.questions Subject: Re: Picking a character from a word Message-ID: <905@cresswell.quintus.UUCP> Date: 27 Apr 88 10:30:28 GMT References: <13125@brl-adm.ARPA> <50995@sun.uucp> Organization: Quintus Computer Systems, Mountain View, CA Lines: 24 In article <50995@sun.uucp>, guy@gorodish.Sun.COM (Guy Harris) writes: > [I wrote] > > Unfortunately, "expr substr" is a BSD-ism which has yet to find its way > > into the SVID. > Actually, "expr substr" is an AT&T-ism that they never documented and that they > thought better of in S3 or so and deleted. Thanks for the information. And thanks for the warning that expr won't work when is one of 'length', 'substr', 'index'. However, deleting those operators did _NOT_ fix the general problem: it doesn't work too well if = "(". It should be noted that test(1) has similar problems: according to the SVID, test $string is supposed to succeed if $string is non-empty, e.g. test "a" is true, and test "" is false. But let $string be "-z", and you get an error message! You would expect that using "-n $string" would eliminate this ambiguity, but it introduces another: try string="="!. The world is still waiting for a UNIX utility like test(1) or expr(1) which works all the time.