[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg and pre-versions



Oliver Elphick wrote:
>> Caret used to be an alternative pipe symbol. though it does not seem to work
>> in bash.  Are there any Linux shells which do interpret it as pipe?  If so,
>> it would be a bad choice as a delimiter.

On Mon, Jan 15, 2001 at 02:41:05PM +0100, Roland Bauerschmidt wrote:
> Zsh interprets it as a '*' as far as I can see. But I am not sure, as I
> never use it.

>From zshexpn(1):

	The character sequence `^foo^bar' (where `^'  is  actually
	the  second  character of the histchars parameter) repeats
	the last command, replacing the string foo with bar.  More
	precisely,  the  sequence  `^foo^bar^'  is synonymous with
	`!!:s^foo^bar^', hence other modifiers  (see  the  section
	`Modifiers') may follow the final `^'.

This isn't quite a pipe, but it's a metacharacter.
Example:
zsh$ ls
foo.a foo.b bar.c bar.d
zsh$ ls foo.*
foo.a foo.b
zsh$ ^foo^bar^
ls bar.*
bar.c bar.d

Also, in ksh, ^ is bitwise exclusive or, at least in arithmetic contexts.
zsh also implements this.
Example:
ksh or zsh$ echo $((2 ^ 4))
6
ksh or zsh$ echo $((31 ^ 16))
15

In the vi editing modes associated with zsh and ksh, ^ also serves as the
"move to beginning of line" motion command, and also as the pattern
matching the beginning of the line in searches, probably from both vi
and emacs editing modes.

Also note that in most string contexts the ^ serves to set the eighth bit
of the following character high in most shells. Witness
almostanyshell$ stty erase '^H'

Cheers,
Bill
-- 
<Karl> Sooo, is this where I can ask a question regarding Debian 2.1?
<xk> Karl: Try #redhat
--



Reply to: