<div dir="ltr"><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 17 March 2014 12:03, Alain Williams <span dir="ltr"><<a href="mailto:addw@phcomp.co.uk" target="_blank">addw@phcomp.co.uk</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">a) $HOME<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:'courier new',monospace">

​This can be over-written on the shell. It's not perfect, and you'll need to do some error handling in case someone's done something silly.​</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


b) getpwuid() (or similar)<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:'courier new',monospace">​Wait, are we dealing with C or bash?​</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

c) $HOME, but if that is not defined: getpwuid()<br></blockquote><div><br></div><div class="gmail_default" style="font-family:'courier new',monospace">That's what "tilde" does by default in bash: <a href="http://wiki.bash-hackers.org/syntax/expansion/tilde?s[]=tilde&s[]=expansion">http://wiki.bash-hackers.org/syntax/expansion/tilde?s[]=tilde&s[]=expansion</a>​​</div>

</div></div></div>