From owner-freebsd-questions@FreeBSD.ORG Fri Jan 26 07:33:18 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2DE816A404 for ; Fri, 26 Jan 2007 07:33:18 +0000 (UTC) (envelope-from dghatikachalam@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.231]) by mx1.freebsd.org (Postfix) with ESMTP id 633F213C494 for ; Fri, 26 Jan 2007 07:33:18 +0000 (UTC) (envelope-from dghatikachalam@gmail.com) Received: by wx-out-0506.google.com with SMTP id s18so711117wxc for ; Thu, 25 Jan 2007 23:33:17 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=SO6i/Kk+eZfitoz213G4tpdgldn5Z2AQXomYB7pwihKclm4AsO3/YUgogwnZewRG7ljxhg2XcdXLuSOrkf7x19MQtMB838OHNyfGrjDiFrGoBT4yal/97oafVb2mkXbJeCyHB+UMZWr3KZjPH33cxAj8us8arXecv3wEbqwdgSw= Received: by 10.70.67.10 with SMTP id p10mr5501381wxa.1169796797592; Thu, 25 Jan 2007 23:33:17 -0800 (PST) Received: by 10.70.52.12 with HTTP; Thu, 25 Jan 2007 23:33:17 -0800 (PST) Message-ID: Date: Fri, 26 Jan 2007 02:33:17 -0500 From: "Dak Ghatikachalam" To: freebsd@celestial.com, freebsd-questions@freebsd.org In-Reply-To: <20070126070730.GA10081@ayn.mi.celestial.com> MIME-Version: 1.0 References: <20070126070730.GA10081@ayn.mi.celestial.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: [OT] Does "~" always point to $HOME? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2007 07:33:18 -0000 On 1/26/07, Bill Campbell 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.