Date: Thu, 25 Jan 2007 23:07:30 -0800 From: Bill Campbell <freebsd@celestial.com> To: freebsd-questions@freebsd.org Subject: Re: [OT] Does "~" always point to $HOME? Message-ID: <20070126070730.GA10081@ayn.mi.celestial.com> In-Reply-To: <ba29b9b40701252251p1e6df8f1xcded017655acbcb2@mail.gmail.com> References: <Pine.LNX.4.43.0701251138500.18233@hymn07.u.washington.edu> <ba29b9b40701252251p1e6df8f1xcded017655acbcb2@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 26, 2007, Dak Ghatikachalam wrote: >I write shells script extensively , I have noticed > >~ -> gets a subsitution for $HOME >~userid - >gets you the $HOME for that user > >meaning if you have have logged in as root and if you want to run some >script on oracle home even though you logged in as root you can simplly > >~oracle/runme.sh -- > will run the runme.sh in Oracle home directory While that's true for most shells, bash, csh, tcsh, etc., it doesn't work on true Bourne /bin/sh shells (e.g. SCO OpenServer 5.0.6a and earlier and probably others with Bell Labs ancestors). It's a Good Idea(tm) when writing scripts that may be used on many systems to program defensively, for the lowest common denominator to avoid pitfalls like this. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070126070730.GA10081>