From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28214 invoked from network); 16 Sep 1998 01:03:14 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Sep 1998 01:03:14 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id UAA25598; Tue, 15 Sep 1998 20:56:55 -0400 (EDT) Resent-Date: Tue, 15 Sep 1998 20:53:07 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980915175556.ZM4582@candle.brasslantern.com> Date: Tue, 15 Sep 1998 17:55:56 -0700 In-Reply-To: Comments: In reply to Amol Deshpande "RE: zsh for win32 - installation of zshrc" (Sep 15, 2:56pm) References: X-Mailer: Z-Mail Lite (5.0.0 30July97) To: zsh-users@math.gatech.edu Subject: Re: zsh for win32 - installation of zshrc MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"CszHJ2.0.VE6.plm_r"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1808 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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).