rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* tilde featuritis alert
@ 1999-12-09  7:52 Decklin Foster
  1999-12-09  8:26 ` Markus Friedl
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Decklin Foster @ 1999-12-09  7:52 UTC (permalink / raw)
  To: rc

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?

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<TAB> if i have a directory in my home called
wwwdocs. but it *won't* do anything with $home/wwwd<TAB>, presumably
since rc is not telling it what's in $home. i note that if I use bash,
$HOME/wwwd<TAB> magically becomes '/home/decklin/wwwdocs/'. bash must
know how interact a little more closley with readline. While this sort
of sets off my bloat detector, it's better than typing a ~, doing tab
completion, and then going back and changing it to $home.

One other thing - is there a replacement for the '~user' idiom? What's
the rc way? grep through /etc/passwd?

-- 
Decklin
Written with Debian GNU/Linux - http://www.debian.org/


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: tilde featuritis alert
@ 1999-12-10  7:45 Byron Rakitzis
  1999-12-10  9:32 ` Gert-Jan Vons
  0 siblings, 1 reply; 9+ messages in thread
From: Byron Rakitzis @ 1999-12-10  7:45 UTC (permalink / raw)
  To: fosterd, rc

>It seems to me that a simple rule would suffice here. An '=' in the
>first word of a command is interpreted as a metacharacter. An '=' in
>the rest of it is not. Oh, but there is the issue of 'foo = bar' (I
>find myself trying to do that frequently in sh now.) OK, an unquoted
>'=' is a metacharacter iff (it's part of the first word || it's the
>first character in the second word). That should continue to allow
>'foo =bar' as well.

For better or for worse, rc's grammar allows for multiple temporary
assignments:

	; foo=1 bar=2 echo $foo $bar
	1 2
	; echo $foo $bar
	
	; 

So you have to account for that as well.

With sufficient tweaking to the parser and lexer perhaps you could allow
unquoted '='s in a parameter list, but I tried my hand at it years ago
and I wasn't able to come up with anything remotely pleasant.

Byron.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-12-10 10:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-09  7:52 tilde featuritis alert Decklin Foster
1999-12-09  8:26 ` Markus Friedl
1999-12-09  8:52 ` Gert-Jan Vons
1999-12-09 14:20   ` Decklin Foster
1999-12-09 16:48   ` Paul Haahr
1999-12-09 16:27 ` Mark K. Gardner
1999-12-09 22:08 ` kim kubik
1999-12-10  7:45 Byron Rakitzis
1999-12-10  9:32 ` Gert-Jan Vons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).