string comparisons
Bill Stewart 908-949-0705 erebus.att.com!wcs
wcs at cbnewsh.att.com
Sun Mar 17 16:16:32 AEST 1991
In article <1991Mar14.225901.3973 at mrspoc.Transact.COM> steven at Transact.COM writes:
]acmfiu at 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.
More information about the Comp.unix.shell
mailing list