I've only had a quick look but basically for just a tilde it looks for $HOME, if there is no $HOME or there was a username appended it looks in the password database otherwise it returns the string unchanged.
On Friday, 10 October 2014 20:23:45 UTC+1, Stefan Karpinski wrote: > > How does bash handle it? > > On Fri, Oct 10, 2014 at 3:22 PM, Sean Marshallsay <[email protected] > <javascript:>> wrote: > >> Hmmm... looking at how bash handles this it doesn't seem too difficult, I >> might give it a go over the weekend. I have no idea how to handle it on >> Windows though. >> >> On Thursday, 9 October 2014 18:06:07 UTC+1, Stefan Karpinski wrote: >>> >>> This is definitely a bug. The implementation on both platforms seems to >>> be a hack – a more correct implementation would be a great contribution. It >>> should also be possible to map arbitrary user names to user IDs and user >>> IDs to user metadata. >>> >>> On Thu, Oct 9, 2014 at 1:00 PM, Sean Marshallsay <[email protected]> >>> wrote: >>> >>>> I noticed the other day that calling expanduser on an empty string >>>> throws a BoundsError when using a UNIX platform. Whether this is a bug or >>>> a >>>> feature will probably depend entirely on who you ask. More importantly >>>> though, in my eyes, doing the same thing on Windows returns an empty >>>> string >>>> instead. This inconsistency definitely seems like a bug to me. >>>> >>>> In my eyes the UNIX implementation should be changed to check for a >>>> empty string and return it but I was wondering what other people thought >>>> of >>>> this? >>>> >>> >>> >
