From owner-freebsd-questions Mon Aug 31 10:09:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA19903 for freebsd-questions-outgoing; Mon, 31 Aug 1998 10:09:02 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from pau-amma.whistle.com (s205m64.whistle.com [207.76.205.64]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA19898 for ; Mon, 31 Aug 1998 10:09:00 -0700 (PDT) (envelope-from dhw@whistle.com) Received: (from dhw@localhost) by pau-amma.whistle.com (8.8.8/8.8.7) id KAA21737; Mon, 31 Aug 1998 10:06:55 -0700 (PDT) (envelope-from dhw) Date: Mon, 31 Aug 1998 10:06:55 -0700 (PDT) From: David Wolfskill Message-Id: <199808311706.KAA21737@pau-amma.whistle.com> To: questions@FreeBSD.ORG, vagner@kf7nn.com Subject: Re: wait for last command In-Reply-To: <199808310233.VAA04752@mutsgo.kf7nn.com> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >From: Laszlo Vagner >Date: Sun, 30 Aug 1998 21:33:52 -0500 (CDT) >when writing a shell script that has say a few lines of executables >to run does it spawn multiple processes at the same time to run them or >does it run them one after the other. Absent the trailing ampersand ("&"), the shell forks the command, then waits for it to return, then processes the next line. (That said, it's possible for the command in question to also fork other processes, and whether or not all of them have terminated before the process the shell forks terminates depends on how they are implemented.) >so are they run sequentially and do they wait to complete before >executing the next line ?? They wait. >i have seen people put && after an executable what is it for? That's normally done in a sequence, such as rm -fr foo && mkdir foo which says "recursively remove foo (and everything in it, if it's a directory); then, if that worked OK, create a (new) "foo" directory. The "&&" is the "logical AND" operator, which is evaluated in a "short circuit" form (as it is in C and Perl): if the return from the first command indicates that it ran successfully, then go ahead and execute the right-hand command. When I make a new kernel, and it's merely a small change (and when I have other things to do as well -- the usual case), I'll generally do cd /sys/i386/conf sudo co -l KERNEL sudo vi !$ sudo ci -u !$ sudo config !$ cd ../../compile/!$ sudo make depend && sudo make && sudo make install && sudo reboot if it's on a machine that isn't otherwise in use (such as one I'm setting up for someone else). david -- David Wolfskill UNIX System Administrator dhw@whistle.com voice: (650) 577-7158 pager: (650) 371-4621 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message