From owner-freebsd-questions@FreeBSD.ORG Wed Dec 22 18:08:19 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8DBF1065674 for ; Wed, 22 Dec 2010 18:08:19 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 843DE8FC0C for ; Wed, 22 Dec 2010 18:08:19 +0000 (UTC) Received: from r55.edvax.de (port-92-195-37-207.dynamic.qsc.de [92.195.37.207]) by mx01.qsc.de (Postfix) with ESMTP id C77C780B7; Wed, 22 Dec 2010 19:08:17 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id oBMI8G1T001576; Wed, 22 Dec 2010 19:08:17 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Wed, 22 Dec 2010 19:08:16 +0100 From: Polytropon To: Chris Brennan Message-Id: <20101222190816.e6932925.freebsd@edvax.de> In-Reply-To: References: <4D11DA76.32672.214EF771@dave.g8kbv.demon.co.uk> <20101222130711.00006546@unknown> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Well, I broke it! FreeBSD V8.1 release X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2010 18:08:20 -0000 On Wed, 22 Dec 2010 09:49:46 -0500, Chris Brennan wrote: > On Wed, Dec 22, 2010 at 8:07 AM, Bruce Cran wrote: > > > On Wed, 22 Dec 2010 11:01:10 -0000 > > "Dave" wrote: > > > > > Sysinstall alows you to select and enable one, but not remove it! > > > > > > Bit of an oversight that I suspect.... > > > > Fixed in r216651 :) > > > > > IIRC ';' isn't a valid bash comment ... (which has been previously discussed > elsewhere). It's usually safer to use '#' for comment in /etc/rc.conf and > other system config files as they typically use BASH style structs. Putting emphasize on _BA_sh seems to be a typical Linuxism. :-) FreeBSD's standard scripting shell is the Bourne Shell, /bin/sh. The Bourne Again Shell, bash, isn't even part of the FreeBSD (base) system. Only under exceptional circumstances there will be a /bin/bash. As it has been pointed out, /etc/rc.conf is a shell script (or to be correct: part of a shell script) that basically consists of variable assignments, name="value". In this context, ; has the default meaning in sh syntax - this refers to Bourne Shell syntax. The ; means "command separator". It is a valid syntactical element of the "sh language". A command like ; saver="NO" causes the shell to stop processing the script (which causes the system boot to stop as it interrupts reading /etc/rc.conf, which interrupts the start of /etc/rc). Infont of ; there has to be a command, and in this case, nothing is there. As the Bourne Shell is the standard scripting shell on most UNIX systems, relying on bash specific constructs may have impact to script portability (which may develop into an issue if you have to create scripts that should run on many different kinds of UNIX). The form : << DELIMITER ... pile ... ... of ... ... text ... DELIMITER is indirectly refered to in "man sh": The following redirection is often called a ``here-document''. [n]<< delimiter here-doc-text ... delimiter All the text on successive lines up to the delimiter is saved away and made available to the command on standard input, or file descriptor n if it is specified. If the delimiter as specified on the initial line is quoted, then the here-doc-text is treated literally, otherwise the text is subjected to parameter expansion, command substitution, and arithmetic expansion (as described in the section on Word Expansions). If the oper- ator is ``<<-'' instead of ``<<'', then leading tabs in the here-doc-text are stripped. // The option of specifying : as a file descriptor works with the standard /bin/sh of FreeBSD, but I'm not sure this should be encouraged for use in configuration files like /etc/rc.conf. Using the form # blah is also better for use with syntax highlighting as comments can be determined more easily, whereas the form using the "here-doc" is primarily a "here-doc" and NOT a comment (unless directed toward :). >From "man sh": The character `#' introduces a comment if used at the beginning of a word. The word starting with `#' and the rest of the line are ignored. // The use of # also makes sure there is NO kind of variable expansion or arithmetic operation done - which you could achieve using : << 'DELIMITER' ... pile ... ... of ... ... text ... $((the)) $USER `/bin/laden` ${causes `NO' touble here! 'DELIMITER' but # is the really safe form, as you can write ANYTHING behind it. Again, the form illustrated above could cause some interpretation problems for syntax highlighting algorithms. See "man rc.conf" for details. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...