Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Mime-Version: 1.0 X-Sender: rschulz AT pop DOT teknowledge DOT com Message-Id: In-Reply-To: <6728-Thu14Sep2000112214+0100-starksb@ebi.ac.uk> References: <20000913193811 DOT 16738 DOT qmail AT web117 DOT yahoomail DOT com> <6728-Thu14Sep2000112214+0100-starksb AT ebi DOT ac DOT uk> Date: Thu, 14 Sep 2000 08:41:03 -0700 To: David Starks-Browning , Guansong Zhang From: Randall R Schulz Subject: Re: set HOME environment Cc: cygwin AT sourceware DOT cygnus DOT com Content-Type: text/plain; charset="us-ascii" X-MDaemon-Deliver-To: cygwin AT sourceware DOT cygnus DOT com X-Return-Path: rschulz AT teknowledge DOT com 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 ) 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 AT sourceware DOT cygnus DOT com