From mboxrd@z Thu Jan 1 00:00:00 1970 From: Randall R Schulz To: David Starks-Browning , Guansong Zhang Cc: cygwin@sourceware.cygnus.com Subject: Re: set HOME environment Date: Thu, 14 Sep 2000 08:50:00 -0000 Message-id: References: <20000913193811.16738.qmail@web117.yahoomail.com> <6728-Thu14Sep2000112214+0100-starksb@ebi.ac.uk> X-SW-Source: 2000-09/msg00481.html Hi, The presence of spaces in file name and path variables is indeed problematic. In particular, the PATH variable inherited by the shell from the Windows environment is rather likely to contain them, and programs that try to manipulate these variables assuming that they have no spaces will surely break. Here's something I've done in lieu of fixing all the scripts I wrote with the tacit assumption of a space-less PATH variable: -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- if [ -z "$SYSPATH" ]; then export SYSPATH="$PATH" export SAFE_SYSPATH="$(echo "$PATH" |sed -e 's/^[^:]* [^:]*://g' \ -e 's/:[^:]* [^:]*//g' )" syspath() { echo "$SYSPATH" |tr ':' $'\n'; } safesyspath() { echo "$SAFE_SYSPATH" |tr ':' $'\n'; } fi resetPATH() { # /usr/local/bin is first to give precedence to CygUtils # (see < http://cygutils.netpedia.net/ >) FULL_PATH=":$HOME/bin:/usr/sbin://c/jdk1.3/bin:$SYSPATH" SAFE_PATH=":$HOME/bin:/usr/sbin://c/jdk1.3/bin:$SAFE_SYSPATH" } safePATH() { PATH="$SAFE_PATH"; } fullPATH() { PATH="$FULL_PATH"; } resetSafePATH() { resetPATH; safePATH; } resetFullPATH() { resetPATH; fullPATH; } -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- I keep this code in a file called ~/.PATH, source that file in my .bash_profile and immediately thereafter invoke "resetSafePATH". If I ever need access to the directories excised from SAFE_PATH, I can issue "resetFullPATH" to get them back. I hope some might find this useful. Randall Schulz Teknowledge Corp. Palo Alto, CA USA At 11:22 +0100 9/14/00, David Starks-Browning wrote: >.... > >That $USER may contain a space is another matter. Adding quotes in >/etc/profile will permit HOME to be defined correctly, space and all, >but whenever $HOME is substituted, things are likely to break. That's >why nobody would (intentionally) have USER/LOGNAME/HOME with an >embedded space in UNIX. If you want Cygwin to work well, you have to >deal with this. > >It's probably better in the long run if these windows users picked a >new, space-less USER and/or HOME variable and set that explicitly in >/etc/profile. > >... > >Cheers, >David -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com