Path: utzoo!attcan!uunet!husc6!mailrus!rutgers!sunybcs!boulder!spot!wu
From: wu@spot.Colorado.EDU (WU SHI-KUEI)
Newsgroups: comp.unix.questions
Subject: Re: what's the use of "{ list }" in /bin/sh?
Message-ID: <6954@sigi.Colorado.EDU>
Date: 6 Jul 88 14:43:53 GMT
References: <23590@teknowledge-vaxc.ARPA>
Sender: news@sigi.Colorado.EDU
Reply-To: wu@spot.Colorado.EDU (WU SHI-KUEI)
Organization: University of Colorado, Boulder
Lines: 23

In article <23590@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes:
>"man sh" (on ultrix) says:
>
>	{ list }
>		The list is simply executed
>
>Under what circumstances is this useful (i.e., why whould one want to
>put braces around a list of commands)?

[ -r "$filename" ] || { echo "Cannot open $filename for reading" ; exit 1 }

is another way of writing

if [ -r "$filename"
then
	echo "Cannot open $filename for reading"
	exit 1
fi

The braces are required so that both commands are executed as if one.

Carl Brandauer
ihnp4!stcvax!nbires!bdaemon!carl