bug-bash
[Top][All Lists]
Advanced

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

Re: compgen -f failing on directory containing single quote


From: DennisW
Subject: Re: compgen -f failing on directory containing single quote
Date: Sun, 13 Dec 2009 08:34:58 -0800 (PST)
User-agent: G2/1.0

On Dec 13, 8:17 am, Freddy Vulto <fvu...@gmail.com> wrote:
> On 091213 05:13, DennisW wrote:
>
> > However, with quoting, these work:
>
> > compgen -f "a\'b/"
> > compgen -f 'a\"b/'
>
> > or using a variable:
>
> > dir="a\'b/"; compgen -f $dir
>
> Both do not work at my machine?  Are you sure you don't have a directory
> `ab' besides `a\'b'?  That's whap happened to me too...
> It seems compgen is leaving out the quote out erroneously:
>
>     $ mkdir a\'b
>     $ touch a\'b/c
>     $ mkdir ab
>     $ touch ab/e
>     $ compgen -f a\'b/
>     ab/e     # Should be a\'b/c
>
> Freddy Vultohttp://fvue.nl

$ ls -ld a*b
ls: cannot access a*b: No such file or directory
$ mkdir a\'b
$ touch a\'b/c
$ compgen -f a\'b/
$ compgen -f "a\'b/"
a\'b/c        # correct
$ mkdir ab
$ touch ab/e
$ compgen -f "a\'b/"
a\'b/c        # correct
$ compgen -f a\'b/
a\'b/e        # INcorrect
$ echo $BASH_VERSION        # Ubuntu 9.10
4.0.33(1)-release

However I just tested it under Cygwin with Bash 3.2.49(23)-release and
got these results similar to yours:

$ ls -ld a*b
ls: cannot access a*b: No such file or directory
$ mkdir a\'b
$ touch a\'b/c
$ compgen -f a\'b/
$ compgen -f "a\'b/"
$ mkdir ab
$ touch ab/e
$ compgen -f "a\'b/"
a\'b/e        # INcorrect
$ compgen -f a\'b/
ab/e          # INcorrect

Here, the quotes didn't give the correct results, but gave different
incorrect ones.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]