From owner-freebsd-questions@FreeBSD.ORG Mon Feb 15 14:48:32 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 49F4C106568B for ; Mon, 15 Feb 2010 14:48:32 +0000 (UTC) (envelope-from mailnull@mips.inka.de) Received: from mail-in-11.arcor-online.net (mail-in-11.arcor-online.net [151.189.21.51]) by mx1.freebsd.org (Postfix) with ESMTP id EF9CA8FC08 for ; Mon, 15 Feb 2010 14:48:31 +0000 (UTC) Received: from mail-in-15-z2.arcor-online.net (mail-in-15-z2.arcor-online.net [151.189.8.32]) by mx.arcor.de (Postfix) with ESMTP id 360B8E3ADD for ; Mon, 15 Feb 2010 15:48:30 +0100 (CET) Received: from mail-in-10.arcor-online.net (mail-in-10.arcor-online.net [151.189.21.50]) by mail-in-15-z2.arcor-online.net (Postfix) with ESMTP id 1B352724486 for ; Mon, 15 Feb 2010 15:48:30 +0100 (CET) Received: from lorvorc.mips.inka.de (dslb-092-075-214-239.pools.arcor-ip.net [92.75.214.239]) by mail-in-10.arcor-online.net (Postfix) with ESMTPS id B247128F08F for ; Mon, 15 Feb 2010 15:48:29 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-10.arcor-online.net B247128F08F Received: from lorvorc.mips.inka.de (localhost [127.0.0.1]) by lorvorc.mips.inka.de (8.14.4/8.14.3) with ESMTP id o1FEmTQp048783 for ; Mon, 15 Feb 2010 15:48:29 +0100 (CET) (envelope-from mailnull@lorvorc.mips.inka.de) Received: (from mailnull@localhost) by lorvorc.mips.inka.de (8.14.4/8.14.4/Submit) id o1FEmTRU048782 for freebsd-questions@freebsd.org; Mon, 15 Feb 2010 15:48:29 +0100 (CET) (envelope-from mailnull) From: naddy@mips.inka.de (Christian Weisgerber) Date: Mon, 15 Feb 2010 14:48:28 +0000 (UTC) Message-ID: References: <560f92641002142207w7eade79fr6a4f40ae5b92f4b9@mail.gmail.com> Originator: naddy@mips.inka.de (Christian Weisgerber) To: freebsd-questions@freebsd.org Subject: Re: simple (and stupid) shell scripting question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2010 14:48:32 -0000 Nerius Landys wrote: > #!/bin/sh > > DIRNAME="`dirname \"$0\"`" > cd "$DIRNAME" > SCRIPTDIR="`pwd`" > > What if I got rid of extra double quotes? Like this: > > DIRNAME=`dirname \"$0\"` > cd "$DIRNAME" > SCRIPTDIR=`pwd` That is perfectly fine. Word-splitting and filename expansion are not performed for variable assignments. Also immune is the expression after "case", so this is always fine: case $FOO in ... -- Christian "naddy" Weisgerber naddy@mips.inka.de