From owner-freebsd-questions@FreeBSD.ORG Mon Feb 15 07:11:31 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 2EC2D106566B for ; Mon, 15 Feb 2010 07:11:31 +0000 (UTC) (envelope-from eray.aslan@caf.com.tr) Received: from mail.caf.com.tr (mail.caf.com.tr [88.250.85.68]) by mx1.freebsd.org (Postfix) with ESMTP id BDF3C8FC08 for ; Mon, 15 Feb 2010 07:11:30 +0000 (UTC) Received: from localhost (sunny.caf.com.tr [127.0.0.1]) by mail.caf.com.tr (Postfix) with ESMTP id BA31439E36E for ; Mon, 15 Feb 2010 06:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=caf.com.tr; h= content-transfer-encoding:content-type:content-type:in-reply-to :references:subject:subject:mime-version:user-agent:from:from :date:date:message-id:received:received; s=originating; t= 1266216911; bh=NCUbd+Zqj1nq+2oHEDA/DXeYelDHuA0VMSm69XOcppI=; b=L YAEn641qVJQyfLx34YgzvOvjtEBMGIkjmZOCjDQmM5rKmnf7uqnOF/PGxXMdPeYy cjh1HNkcdBv2msRLoPkbiw55pOh7Mg5ovLyvQmJGZYN8pFK+SffjOY+rodVodqWG Y8DN18xS1JvnUSLS893Me0zoIlggEnuCi4dCWJ2yDo= X-Virus-Scanned: amavisd-new at caf.com.tr Received: from mail.caf.com.tr ([127.0.0.1]) by localhost (sunny.caf.com.tr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CGATDgWDD-OE for ; Mon, 15 Feb 2010 06:55:11 +0000 (UTC) Received: from [10.0.0.11] (unknown [10.0.0.11]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: eray.aslan@zeplin.net) by mail.caf.com.tr (Postfix) with ESMTPSA id 7DD8939E361 for ; Mon, 15 Feb 2010 06:55:11 +0000 (UTC) Message-ID: <4B78EFCC.2010102@caf.com.tr> Date: Mon, 15 Feb 2010 08:55:08 +0200 From: Eray Aslan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <560f92641002142207w7eade79fr6a4f40ae5b92f4b9@mail.gmail.com> In-Reply-To: <560f92641002142207w7eade79fr6a4f40ae5b92f4b9@mail.gmail.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 07:11:31 -0000 On 15.02.2010 08:07, Nerius Landys wrote: > 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` > > Does this behave any differently in any kind of case? Are thes double > quotes just superfluous? >From the man page: Command Substitution [...] If the substitution appears within double quotes, word splitting and pathname expansion are not performed on the results. In other words: sh-4.0$ touch "x y" sh-4.0$ for i in `ls`; do echo "$i"; done x y sh-4.0$ for i in "`ls`"; do echo "$i"; done x y sh-4.0$ -- Eray