why does -vi- set the hi bit when expanding `%' and `#'?

Norman Joseph norm at oglvee.UUCP
Tue Jan 10 00:45:57 AEST 1989


>From article <8700002 at gistdev>, by dlp at gistdev.UUCP:
> => oglvee.UUCP!norm says:
> =>     I am editing a file with vi (say `file.c'), and I want to
> => print it without leaving the editor, so I escape to the command
> => line by hitting `:' and I type `` :!lp % ''.
> 
> Just out of curiousity, why don't you just `` :w !lp '' ?  I assume
> your `lp` reads stdin if there are no filename arguments.

You are the second poster to suggest this approach to me, and to be
honest, it never occurred to me (even though I use the related
command `` :r !<command> '').  This approach works on my system,
and I may never need to use the `%' macro again (except when I want
to use a command that -doesn't- read from stdin!).  I thank both you
and the other poster (fcival!dac) for the suggestion.

Good, so now I've learned a new vi trick, but I -haven't- learned why
vi sets extra bits in the characters of the file name when expanding
the `%' and `#' file name macros, which was the intent of my original
posting.

In article <15219 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> vi believes that by setting bit 7, it is quoting the file name,
> so that if you are editing the file `foo*bar.c', the command
> 
> 	!echo %
> 
> produces
> 
> 	!echo \f\o\o\*\b\a\r\.\c
> 
> in shell-internal-quoting format (bit 7 set).

Maybe I'm just thick, or maybe I was home sick the day they explained
``shell-internal-quoting format'' to everyone, but would some kind
soul who knows what Chris is talking about care to fill me in? (E-mail
would be fine.  I'm sure people are falling asleep even as we speak :^).
Is this the same as quoting sh meta-characters with '\'?  Is this
something I need to care about beyond being curious?
-- 
Norm Joseph - Oglevee Computer System, Inc.
UUCP: ...!{pitt,cgh}!amanue!oglvee!norm
"Mate, that parrot wouldn't *VROOM* if you put four million volts through it!"



More information about the Comp.unix.questions mailing list