Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Nov 1998 13:48:08 -0500
From:      Glen Mann <gmann@itw.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   sh programming question
Message-ID:  <36531668.2C2CD440@itw.com>

next in thread | raw e-mail | index | archive | help
Sorry if this should go elsewhere, but it should be pretty simple.

In a Bourne shell script, I want to compare two lists, obtained e.g.
with 
  list1=`ls $dirname1`
  list2=`ls $dirname2`
in order to determine what elements are in list1 and list2, or in one
but not the other.  The two lists will always be sorted, but not
necessarily directory listings.  I'd like to do this without using
temporary files.  I could use arrays in a Bash script and step through
the lists, but want to stick with sh.  Is there an easy way to do this,
perhaps using sort and uniq?

Thanks
-Glen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36531668.2C2CD440>