From owner-freebsd-questions@FreeBSD.ORG Fri Nov 16 06:34:35 2007 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 349F916A417 for ; Fri, 16 Nov 2007 06:34:35 +0000 (UTC) (envelope-from girishvenkatachalam@gmail.com) Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.188]) by mx1.freebsd.org (Postfix) with ESMTP id 0A17413C459 for ; Fri, 16 Nov 2007 06:34:34 +0000 (UTC) (envelope-from girishvenkatachalam@gmail.com) Received: by rv-out-0910.google.com with SMTP id l15so592939rvb for ; Thu, 15 Nov 2007 22:34:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:received:date:from:to:subject:message-id:reply-to:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; bh=U5nk2DfdvR66yPKTePqZXEapkIWI3UXuP6pjJIWrX0c=; b=WCSS2/pWBGL5tCZo5NOFnD1XU1EYWjVfoaDTEWAsakFoquDXYd6H4X5453hHciXdEZrbAZ4wP5uxD3syCLMhMxUcROxsrOqItACp0R20ezONd6COBqqePxj7GKjV1ONGYp/2WJoXOoTwMI+vZ+q4K3LIUFaQjH3WUM9EOjwITro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:subject:message-id:reply-to:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=X/2QyfjKC5aGQ8tmokiBH0RCDTTC07p3luK64tQh5sccSXh4XCprUnlAsE8+u4Eg9eNEuFW6U9mqTM4yXqBlOa/wIsHNExTSz0a1T3raG/fqm6ih+JQej2SPVfXDQT5fc6mLu9ItCGAk2svEc5ONiJtHHo9S5ctD8nAQbV/xhcY= Received: by 10.141.115.6 with SMTP id s6mr455317rvm.1195194867711; Thu, 15 Nov 2007 22:34:27 -0800 (PST) Received: from saraswathy.susmita.org ( [59.92.57.146]) by mx.google.com with ESMTPS id g22sm4667080rvb.2007.11.15.22.34.25 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2007 22:34:26 -0800 (PST) Received: by saraswathy.susmita.org (Postfix, from userid 1002) id 96E19143E7; Fri, 16 Nov 2007 12:04:21 +0530 (IST) Date: Fri, 16 Nov 2007 12:04:21 +0530 From: Girish Venkatachalam To: freebsd-questions@freebsd.org Message-ID: <20071116063421.GA4164@saraswathy.susmita.org> Mail-Followup-To: freebsd-questions@freebsd.org References: <52275.12.170.206.13.1195184604.squirrel@admintool.trueband.net> <20071116044331.GA21372@saraswathy.susmita.org> <473D2837.6000301@u.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <473D2837.6000301@u.washington.edu> User-Agent: Mutt/1.5.12-2006-07-14 Subject: Re: bash and strings X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: girishvenkatachalam@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2007 06:34:35 -0000 On 21:18:47 Nov 15, Garrett Cooper wrote: > A better way would be to quote the string variables, i.e.: > > DIR=`/usr/bin/dirname "$path"` > FILE=`/usr/bin/basename "$path"` > /bin/mkdir -p "$DIR" > touch "$FILE" > > Otherwise dirname and basename will choke on non-escaped characters > (i.e. spaces), mkdir/touch will make funky directories / files, > respectively. > > Just watch out for '$' chars in $path... > > Welcome to the wonderful world of [in]secure shell scripting :). > Thanks buddy. :) I missed out something obvious. Ever willing to learn. regards, Girish