This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Re: stupid spaces in environment vars


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]