From owner-freebsd-questions@FreeBSD.ORG Fri Jan 26 07:03:34 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 2C03416A400 for ; Fri, 26 Jan 2007 07:03:34 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from ayn.mi.celestial.com (hayek.celestial.com [192.136.111.12]) by mx1.freebsd.org (Postfix) with ESMTP id 0DDC713C46C for ; Fri, 26 Jan 2007 07:03:33 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from localhost (localhost [127.0.0.1]) by ayn.mi.celestial.com (Postfix) with ESMTP id 0A7856860B908; Thu, 25 Jan 2007 23:07:31 -0800 (PST) X-Virus-Scanned: amavisd-new at mi.celestial.com Received: from ayn.mi.celestial.com ([127.0.0.1]) by localhost (ayn.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id W3pLGMn8KvZJ; Thu, 25 Jan 2007 23:07:30 -0800 (PST) Received: by ayn.mi.celestial.com (Postfix, from userid 203) id E2EEE6800A4F4; Thu, 25 Jan 2007 23:07:30 -0800 (PST) Date: Thu, 25 Jan 2007 23:07:30 -0800 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20070126070730.GA10081@ayn.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 OpenPKG/2.5 Subject: Re: [OT] Does "~" always point to $HOME? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2007 07:03:34 -0000 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.