Get Cygwin home directory path for current user

Eric Blake eblake@redhat.com
Thu Feb 14 20:23:00 GMT 2019


On 2/14/19 1:40 PM, Bill Stewart wrote:
> According to this:
> 
> https://stackoverflow.com/questions/42841907/
> 
> cygpath -w ~
> 
> ...formerly produced to stdout the home directory path for the current user.
> 
> This seems not be the case any more: When I run cygpath -w ~, I get just ~.

What shell are you using?

> 
> Is this by design? If so, what's the way to programmatically determine
> the Windows path of ~?

Depending on the shell, ~ is expanded to $HOME prior to invoking a
program. But if you want to take the shell's expansions out of the
equation, you could use:

cygpath -w "$HOME"

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190214/edc46895/attachment.sig>


More information about the Cygwin mailing list