Date: Fri, 16 Nov 2007 12:04:21 +0530 From: Girish Venkatachalam <girishvenkatachalam@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: bash and strings Message-ID: <20071116063421.GA4164@saraswathy.susmita.org> In-Reply-To: <473D2837.6000301@u.washington.edu> References: <52275.12.170.206.13.1195184604.squirrel@admintool.trueband.net> <20071116044331.GA21372@saraswathy.susmita.org> <473D2837.6000301@u.washington.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071116063421.GA4164>