Thanks, both you and Matthew Boeh have pointed
out my mistaken understanding of Bash Protocol,
Must I always find out how much DON'T KNOW! :-)

Anyways, the python example below seems to point
out that I am at least I am right about the second form:

Using irb:  In a directory I have two sub_directories
~chuck (And a user named chuck) and ~test which
 does not match any user!  As you can see the second
form fails.  This at least should be an error!

irb(main):002:0> File.expand_path("~chuck")
=> "/home/chuck"

irb(main):003:0> File.expand_path("~test")
ArgumentError: user test doesn't exist
        from (irb):3:in `expand_path'
        from (irb):3
        from :0
irb(main):004:0>

I am going to try to create a patch to fix this, just
in case I am right this time, sigh ;-)

Chuck T.



Rune Hammersland wrote:
> On 19. juli. 2008, at 03:04, Matthew Boeh wrote:
>> A better fix to match the Bourne shell behavior would be to get rid
>> of the "user %s doesn't exist" exception entirely and leave the
>> string unchanged.
>
> I somewhat agree. Python also does this the same way as Bash [1]:
>
> >>> os.path.expanduser("~rune")
> '/Users/rune'
> >>> os.path.expanduser("~asdf")
> '~asdf'
>
> However; according to the ri documentation, File.expand_path returns
> an absolute path, so we should probably return CWD + argument, and
> not just an unaltered argument:
>
> i.e.:
> $ cd /usr/local; ruby -e 'p File.expand_path("~asdf")'
> "/usr/local/~asdf"
>
> [1]: See also the section ?Tilde Expansion? in the Bash man page.
>


-- 
Competency and chastity have much in common,
they both encompass their own punishment! 
 
-- C.E. Thornton -- Hawthorne Press --