Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2008 14:50:24 -0700
From:      Gary Kline <kline@thought.org>
To:        David Kelly <dkelly@hiwaay.net>
Cc:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>, FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: why is this script failing?
Message-ID:  <20080715215024.GA82902@thought.org>
In-Reply-To: <20080715190224.GC21840@Grumpy.DynDNS.org>
References:  <20080714201241.GA22443@thought.org> <20080715073651.P1638@wojtek.tensor.gdynia.pl> <20080715183500.GA76088@thought.org> <20080715190224.GC21840@Grumpy.DynDNS.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jul 15, 2008 at 02:02:24PM -0500, David Kelly wrote:
> On Tue, Jul 15, 2008 at 11:35:00AM -0700, Gary Kline wrote:
> > On Tue, Jul 15, 2008 at 07:37:02AM +0200, Wojciech Puchar wrote:
> > > >
> > > >	why is this script not finding them?
> > > >
> > > >
> > > >wav=/tmp/kde-kline/\*wav\*
> > > 
> > > why you put \ before *
> > 
> > 	to allow the shell to catch various formsof strings with "wav"
> > 	embedded.
> 
> I questioned that escape earlier.
> 
> Without the \ escape the variable ${wav} will contain all the files
> matching the pattern. But with the escape it will literally be 
> "/tmp/kde-kline/*wav*". Wildcard expansion doesn't occur until later
> when Gary does something like this:
> 
> rm ${wav}
> 
> which is processed as if he had just now typed:
> 
> rm /tmp/kde-kline/*wav*
> 
> while without the escape it might appear like this:
> 
> rm /tmp/kde-kline/file1.wav /tmp/kde-kline/file2.wav
> 
> Is probably best to postpone wildcard expansion until the last moment
> because if any of the filenames contain spaces the space will probably
> cause a break between arguments. The first time the wildcard expands to
> a filename with a space the space will be escaped. But the second time
> you use it that escape is lost. So its best to expand it in the place
> its needed.
> 


	thanks for this clarification!  until yesterday, whe  you
	mmentioned blanks[whitespace], as id a song title, i  hadn't
	tought about songs like "Not Ready to Make Nice.ogg" e.g.
	I am not sure why these players store the  song in wav format
	without deleting the files, but when my limited /tmp is full,
	certain aps fail mysteriously.  with a fwdozen more line of code
	they could at least fail more gracefully.

	-g


> -- 
> David Kelly N4HHE, dkelly@HiWAAY.net
> ========================================================================
> Whom computers would destroy, they must first drive mad.

-- 
  Gary Kline  kline@thought.org   www.thought.org  Public Service Unix
        http://jottings.thought.org   http://transfinite.thought.org





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080715215024.GA82902>