Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!gatech!rutgers!ucsd!ucbvax!decwrl!palo-alto!vixie From: vixie@palo-alto.DEC.COM (Paul Vixie) Newsgroups: comp.unix.questions Subject: Re: what's the use of "{ list }" in /bin/sh? Message-ID: <3305@palo-alto.DEC.COM> Date: 6 Jul 88 08:47:27 GMT References: <23590@teknowledge-vaxc.ARPA> Organization: DEC Western Research Lab Lines: 45 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)? [ -f /etc/ptmp ] && { echo "hmmm, a ptmp. maybe vipw was active at time of crash?" } vs if [ -f /etc/ptmp ]; then echo "..." fi I leave it to each of you out there to decide which looks better. Or: [ -f /dev/console ] || { echo "hey, /dev/console's gone again." /etc/mknod /dev/console ... } vs if [ ! -f /dev/console ]; then echo "..." /etc/mknod ... fi This is a different comparison, and can be better or worse than the first one depending on how you felt about the first one. Summary: {list} is useful if you go southpaw with it. Other than that it seems useless and I can't imagine why it exists. -- Paul Vixie Digital Equipment Corporation Work: vixie@dec.com Play: paul@vixie.UUCP Western Research Laboratory uunet!decwrl!vixie uunet!vixie!paul Palo Alto, California, USA +1 415 853 6600 +1 415 864 7013