From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from janus.ocegr.fr ([194.3.183.34]) by hawkwind.utcs.utoronto.ca with SMTP id <24774>; Thu, 9 Dec 1999 04:25:06 -0500 Received: (qmail 12669 invoked from network); 9 Dec 1999 08:46:36 -0000 Received: from hydra.ocegr.fr (HELO ocegr.fr) (134.188.135.3) by janus.ocegr.fr with SMTP; 9 Dec 1999 08:46:36 -0000 Received: from alcina (alcina.ocegr.fr [134.188.136.183]) by ocegr.fr (8.8.8/8.8.8) with ESMTP id JAA11629; Thu, 9 Dec 1999 09:54:45 +0100 (MET) Message-Id: <4.2.2.19991209092255.00ae2380@mailhost.ocegr.fr> X-Sender: vons@mailhost.ocegr.fr X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.2 Date: Thu, 9 Dec 1999 03:52:35 -0500 To: rc@hawkwind.utcs.toronto.edu, Decklin Foster From: Gert-Jan Vons Subject: Re: tilde featuritis alert In-Reply-To: <19991209025205.B305@debian> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Decklin Foster wrote: >I'm sure this has come up before, but being a relative rc newbie, I >really miss my '~' for home directory from bash. my question is, what >exactly is the pattern matching '~' in rc *good* for? can't you just >use 'switch' and end up with more readable code? couldn't we call it >'match'? is the lack of an sh-like '~' a personal preference of the >author, or just not feasible to implement due to rc's eval-once >semantics? Something like "if (~ a b || ~ c d)" becomes quite messy when you only have 'switch'. >I know i probably ought to be quiet and retrain my fingers, but old >habits die hard. if i can't patch rc for this, how can i set up >readline to get along with it? my problem is that readline will do tab >completion on ~/wwwd if i have a directory in my home called >wwwdocs. but it *won't* do anything with $home/wwwd, presumably >since rc is not telling it what's in $home. I doubt you will see tilde expansion in rc anytime soon, since it doesn't go with the philosophy behind the shell (just look at the debates over 'echo' being built-in or not). The conflict with the ~ operator is another reason of course. You can get rc to expand $home (or any other environment variable) when you hit [tab] for filename completion by using the "vrl" commandline editor instead of readline. I've been thinking and discussing a bit with other rc/vrl users about adding ~ expansion to the vrl command-line editor, but it ain't that simple since there's no easy way to know whether the user wants the ~ to be the ~ operator or not. I now have the habit of typing $home/foo instead of ~/foo, or /home/user instead of ~user. Typing can be reduced by defining h=$home and using $h/foo, but I agree it is hard to change old habits :) Something that I still haven't gotten used to even after 5-6 years of using rc is the need to quote command arguments if there's an equal sign like in "dd 'if=infile' 'of=outfile'". I once asked for an extension that would allow me to do "dd if\=infile of\=outfile" but that got killed pretty fast :-/ Gert-Jan ----- "If you are good, you will be assigned all the work. If you are really good, you will get out of it." - Dilbert