Subject: Re: rmdir(".")
To: None <tech-kern@NetBSD.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-kern
Date: 09/09/2005 15:26:47
Ben Collver wrote:
> On Fri, Sep 09, 2005 at 12:58:10PM +0200, Alan Barrett wrote:
>>On Fri, 09 Sep 2005, Roland Illig wrote:
>>>Alan Barrett wrote:
>>>
>>>>"rmdir $(pwd)" works.  "rmdir ." is not allowed.
>>>
>>>did you mean this:?
>>>$ rmdir "$(pwd)"
>>
>>Of course, I would not actually do that without proper quoting around
>>the "$(pwd)", but nested levels of quotes would have made my comment
>>harder to read.
> 
> 
> There is no need to quote command expansion, so your original example
> was whitespace safe.
> 
> $ mkdir "dir a" && cd "dir a"
> $ sh -c 'foo=$(pwd); echo $foo'
> /home/ben/dir a

You're comparing apples with oranges here. Alan wrote:

   rmdir $(pwd)

and you wrote:

   foo=$(pwd); echo $pwd

You know that the quotes are not needed with variable assignments, do 
you? That's the difference here.

Did you try your example with "cd" instead of "echo"? And with directory 
"a      dir" instead of "a dir"?

   mkdir "a *   dir"
   cd "a *   dir"
   cd $(pwd)

Roland