delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/02/08/15:58:11

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Subject: RE: Re: stupid spaces in environment vars
Date: Thu, 8 Feb 2007 15:57:47 -0500
Message-ID: <31DDB7BE4BF41D4888D41709C476B657068AA9A9@NIHCESMLBX5.nih.gov>
In-Reply-To: A<88kms217e9imfeblbgurjc4e5c09b6ub2v@4ax.com>
References: <45CA8AAF DOT 9050107 AT cygwin DOT com> <533213 DOT 63517 DOT qm AT web58615 DOT mail DOT re3 DOT yahoo DOT com> A<88kms217e9imfeblbgurjc4e5c09b6ub2v AT 4ax DOT com>
From: "Buchbinder, Barry \(NIH/NIAID\) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id l18Kw0qt016182

Andrew Schulman wrote on Thursday, February 08, 2007 11:36 AM:
>> BAD:
>> alias cdp=cd\ "$USERPROFILE"
>> +alias 'cdp=cd C:\Documents and Settings\me'
>> 
>> alias cdp="cd $USERPROFILE"
>> +alias 'cdp=cd C:\Documents and Settings\me'
>> 
>> GOOD:
>> alias cdp="cd \"$USERPROFILE\""
>> + alias 'cdp=cd "C:\Documents and Settings\me"'
>> 
>> alias cdp='cd "$USERPROFILE"'
>> + alias 'cdp=cd "$USERPROFILE"'
> 
> To avoid one layer of quoting, how about
> 
> function cdp () { cd "$USERPROFILE"; }

What about the following?

/c> cd "$(cygpath -u "${USERPROFILE}")"

Would it add anything to do this with cygpath, which already gives some
system paths?

/c> cygpath --help
 [snip]
System information:
  -A, --allusers        use `All Users' instead of current user for -D,
-P
  -D, --desktop         output `Desktop' directory and exit
  -H, --homeroot        output `Profiles' directory (home root) and exit
  -P, --smprograms      output Start Menu `Programs' directory and exit
  -S, --sysdir          output system directory and exit
  -W, --windir          output `Windows' directory and exit
Other options:
  -f, --file FILE       read FILE for input; use - to read from STDIN
[snip]
 [snip]

Might it be useful to add another option:

  -e, --environment VARIABLE       convert path in an environmental
variable

so that one could do

/c> cd "$(cygpath -u -e USERPROFILE)"

I know PTC, but I'm not a programmer.  As always much gratitude to
everyone who is a programmer and maintains or otherwise contributes to
cygwin!

- Barry
  -  Disclaimer: Statements made herein are not made on behalf of NIAID.

--
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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019