From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12987 invoked from network); 16 Sep 1998 23:16:51 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Sep 1998 23:16:51 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id TAA18714; Wed, 16 Sep 1998 19:09:39 -0400 (EDT) Resent-Date: Wed, 16 Sep 1998 19:05:40 -0400 (EDT) Message-ID: From: Amol Deshpande To: zsh-users@math.gatech.edu, "'Bart Schaefer'" Subject: RE: zsh for win32 - installation of zshrc Date: Wed, 16 Sep 1998 16:08:22 -0700 X-Mailer: Internet Mail Service (5.5.2232.9) Resent-Message-ID: <"uwrbz1.0.4Z4.4H40s"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1824 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu i put in code to hash foo.exe as foo as well as foo.exe bogus corrections should be reduced a bit by this. (check for version 0.50) thanks, -amol > ---------- > From: Bart Schaefer[SMTP:schaefer@brasslantern.com] > Sent: Tuesday, September 15, 1998 5:55 PM > To: zsh-users@math.gatech.edu > Subject: Re: zsh for win32 - installation of zshrc > > On Sep 15, 2:56pm, Amol Deshpande wrote: > > > > > > "setopt correct" is worthless because it uses the full file name (e.g. > > > "foo.exe") when trying to correct the spelling of a command ("foo") > and > > > therefore complains about nearly everything except builtins. (This is > > > probably fixable by playing with hash/unhash commands.) > > > > > it's actually fixable by just renaming all your foo.exes to foo :-) > > I wrote this little fragment of code to fix it (still not handling all > the possible extensions, just .exe): > > function fixhash { > emulate -R zsh > setopt localoptions > local hashed exe > hash -f > eval hashed=\( $(hash) \) > exe=( ${(M)hashed:#*.[Ee][Xx][Ee]\=*} ) > hashed=( ${hashed%%\=*} ) > hashed=( ${hashed:#*.[Ee][Xx][Ee]} ) > hashed=( ${(M)hashed:#*.*} ) > [[ $#hashed -gt 0 ]] && unhash $hashed > [[ $#exe -gt 0 ]] && hash ${exe:l:s/.exe//} > } > > However, running that function takes a LONG time and then crashes the > shell. > Right before the shell crashes, the $hashed array is 1349 elements long > and > contains just over 16000 bytes. > > If I don't put the commands in a function, simply type everything from the > "hash -f" to the end directly at the PS1 prompt (or put it in .zshrc), > then > it still takes a long time -- particularly "eval hashed=\( $(hash) \)" -- > but the shell doesn't crash. > > > For example, HOMDRIVE=F:, and HOMEPATH=\ > > so, if FOO=$HOMEDRIVE$HOMEPATH, then FOO is set > > to F:\. > > > > this will confuse the shell no end (all paths MUST be '/'-delimited) > > Hmm, that's interesting. Right now I have HOME=d:\home\schaefer and I > don't have winntconvertbackslash and the shell seems to be doing fine. > (Everything in $PATH is forward-slash-delimited, though.) > > > in tcsh i could just do > > > > set bar=$var:s#\\#/#:ah > > > > but I was told there was no simple way in zsh to do the same. > > bar=${var:gs@\\@/@} > > works fine. Going the other way is trickier: > > var=${bar:gs@/@\\\\@} > > I don't know why the extra two backslashes are needed. Anyone? > > > BTW, please don't cc amol@blarg.net. > > Sorry; my UA copied the Cc: from your own headers. (I've been deleting > amold@microsoft.com from the To: header by hand). >