David Coulson on 26 Jan 2013 14:29:21 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Update: Strange Bash Behavior vis-a-vis Embedded Spaces and Wildcards


Your quote includes the asterisk, so it is interpreted as a literal, rather than wildcard. 

Sent from my iPad

On Jan 26, 2013, at 5:27 PM, Casey Bralla <MailList@nerdworld.org> wrote:

> Ooops, I over-simplified the example:
> 
> try
> 
> ls "directory with spaces/*name"   (with a wildcard).  
> 
> 
> 
> but 
> 
> ls directory\ with\ spaces/*name  works
> 
> 
> 
> Also, as David Coulson suggested
> 
>  ls "directory with spaces"/*name also works.
> 
> It must be something with the quoted wildcard.
> 
> 
> 
> 
> 
> 
> 
> On Saturday, January 26, 2013 4:13:37 PM Casey Bralla wrote:
>> I recently tried to do a file deletion and got some strange results.
>> 
>> If I did this command:
>> 
>> rm "/directory with spaces/filename" (with quotes around the full path and
>> file name) the command would error out with a file-not-found error.
>> 
>> However, this command works just fine:
>> 
>> rm /directory\ with\ spaces/filename
>> 
>> 
>> I thought quoting the filename would work, but I had to escape the spaces
>> to make it work.  I find the escape method to be difficult to read, while
>> the quoted string is very easy.  Hence, I always use the quoted method.
>> 
>> Can anybody explain why the quoted string does not work?
> 
> -- 
> 
> 
> Casey Bralla
> 
> Chief Nerd in Residence
> The NerdWorld Organisation
> www.NerdWorld.org
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug