Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!wcs From: wcs@cbnewsh.att.com (Bill Stewart 908-949-0705 erebus.att.com!wcs) Newsgroups: comp.unix.shell Subject: Re: string comparisons Message-ID: <1991Mar17.061632.4096@cbnewsh.att.com> Date: 17 Mar 91 06:16:32 GMT References: <2847@kluge.fiu.edu> <1991Mar14.225901.3973@mrspoc.Transact.COM> Organization: Here, beside the rising tide Lines: 18 In article <1991Mar14.225901.3973@mrspoc.Transact.COM> steven@Transact.COM writes: ]acmfiu@serss0.fiu.edu (ACMFIU) writes: ] ]>under csh or sh, how do i compare two strings? ] ]Either use expr(1) or awk(1). Depends on how elaborate you want to get. The test program (aka "[") is accessible from either shell, and is a builtin for modern shells like ksh. In sh, just do if [ "$foo" = "$bar" ] then true-stuff else false-stuff Read the manual for csh. -- Pray for peace; Bill # Bill Stewart 908-949-0705 erebus.att.com!wcs AT&T Bell Labs 4M-312 Holmdel NJ # Hacker. System Designer. Troublemaker.