Date: Fri, 26 Jan 2007 02:33:17 -0500 From: "Dak Ghatikachalam" <dghatikachalam@gmail.com> To: freebsd@celestial.com, freebsd-questions@freebsd.org Subject: Re: [OT] Does "~" always point to $HOME? Message-ID: <ba29b9b40701252333nac507ebhc4b08033b444e425@mail.gmail.com> In-Reply-To: <20070126070730.GA10081@ayn.mi.celestial.com> References: <Pine.LNX.4.43.0701251138500.18233@hymn07.u.washington.edu> <ba29b9b40701252251p1e6df8f1xcded017655acbcb2@mail.gmail.com> <20070126070730.GA10081@ayn.mi.celestial.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1/26/07, Bill Campbell <freebsd@celestial.com> wrote: > > 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. > > I kinda disagree with that because if you want to exploit capabilities of any given shell we should really stick to those shell For example , I doubt that we can expect Bourne Shell code to run in CSH given as such, if it is small piece of code, we just need to stick with its common capabilities . But then when you are writing fully functional script such as complete RMAN backup or restore and if you want to automate , you will need to exploit all capabilities of that give shell for the script to be fully functional.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ba29b9b40701252333nac507ebhc4b08033b444e425>