Re: "su -m" (on Mac) preserves $HOME and $USER but not ~
From:
Chet Ramey
Subject:
Re: "su -m" (on Mac) preserves $HOME and $USER but not ~
Date:
Thu, 29 Oct 2015 20:36:58 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
On 10/29/15 1:02 PM, dabe@dabe.com wrote:
> Machine Type: x86_64-apple-darwin13.4.0
>
> Bash Version: 4.3
> Patch Level: 42
> Release Status: release
>
> Description:
>
> I'm hoping this issue has been solved before, but I couldn't
> find any answers on the 'Net...
>
> When I "su -m", my $HOME environment variable is preserved okay
> (i.e., it remains my original home directory) but often[*] '~'
> is set to the target (root) user's home directory.
I can't reproduce this on Mac OS X 10.11. It's weird to see how it could
happen, since ~ expands to $HOME and goes to the password file only if
that is unset.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/