Date: Fri, 26 Jan 2007 15:21:14 +0100 From: Karol Kwiatkowski <karol.kwiat@gmail.com> To: Bill Campbell <freebsd@celestial.com> Cc: freebsd-questions@freebsd.org Subject: Re: [OT] Does "~" always point to $HOME? Message-ID: <45BA0E5A.6030503@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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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). Not sure what I'm missing, is FreeBSD's /bin/sh shell not "true" Bourne Shell? Was it extended in some way from traditional one? % karol@blackacidevil$ uname -spr % FreeBSD 6.2-STABLE i386 % karol@blackacidevil$ printenv SHELL % /bin/sh % karol@blackacidevil$ cd test % karol@blackacidevil$ pwd % /home/karol/test % karol@blackacidevil$ cd ~ % karol@blackacidevil$ pwd % /home/karol % karol@blackacidevil$ cd ~kadu % karol@blackacidevil$ pwd % /home/kadu > 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 Agreed. Karol -- Karol Kwiatkowski <karol.kwiat at gmail dot com> OpenPGP 0x06E09309 [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFug5hezeoPAwGIYsRCDExAKChpQ0dUmNn78cYZ/fdggJY5SexFgCgjFFa ghLGebxSargR454kBtlK8kw= =Dr5E -----END PGP SIGNATURE-----home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45BA0E5A.6030503>
