Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 26 Sep 2004 20:12:47 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: =?ISO-8859-1?Q?Sven_K=F6hler?= cc: cygwin AT cygwin DOT com Subject: Re: "which" command does not expand "~" in path In-Reply-To: Message-ID: References: <1094385246 DOT 5803 DOT ezmlm AT cygwin DOT com> <6 DOT 1 DOT 2 DOT 0 DOT 1 DOT 20040926005459 DOT 02810cb0 AT mail DOT ros DOT com DOT au> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1483920592-1096243967=:630" X-Scanned-By: MIMEDefang 2.39 ---559023410-1483920592-1096243967=:630 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Sun, 26 Sep 2004, Sven Köhler wrote: > > > Instead, the shell usually substitutes ~ or ~user. > > > Look at this the output of these commands: > > > echo ~ > > > echo "~" > > > > This is probably common knowledge, but I learned last night that sh never > > expands ~. Under sh, the two lines above yield the same output, simply ~. > > I can confirm that for cygwin. > The "common knowledge" may be, because the most Linux-systems have sh linked > to bash. Cygwin seems to have a separate "sh" installed. As do most non-Linux systems. > But is there any command that give's me the home for a given username? bash -c "echo ~username" ];-> Or you could write one using the getpwnam() call (better yet, the reentrant versions, getpwnam_r()), and submit it to, say, cygutils (since sh-utils is no longer being actively developed). Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Happiness lies in being privileged to work hard for long hours in doing whatever you think is worth doing." -- Dr. Jubal Harshaw ---559023410-1483920592-1096243967=:630 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ---559023410-1483920592-1096243967=:630--