Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Nov 1999 06:16:12 -0800 (PST)
From:      David Wolfskill <dhw@whistle.com>
To:        rk@nanoteq.co.za, unknown@riverstyx.net
Cc:        freebsd-newbies@FreeBSD.ORG
Subject:   Re: vi and plus
Message-ID:  <199911251416.GAA02393@pau-amma.whistle.com>
In-Reply-To: <19991125023115.A27320@riverstyx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
>Date: Thu, 25 Nov 1999 02:31:15 -0800
>From: Tani Hosokawa <unknown@riverstyx.net>

[This probably ought to have gone to -questions, but I thought it would
be better to let the folks who saw the original messages see what I
had to say about it.  And I've re-ordered some text.  dhw]

>On Thu, Nov 25, 1999 at 11:23:01AM +0200, Riaan Kruger wrote:
>> Is it at all possible to edit a file with vi that start with a plus/"+",
>> for example +CONTENTS.  The man page says the +whatever is used for some
>> kind of command.

>Sure..

>vi -- +CONTENTS

>Works for me.  Generally, you can use -- to specify the end of flags, ie.

>rm -- -filename

>normally rm would treat -filename as some kind of argment, like vi does with +.

Actually, the use of "--" in that way has but recently (within the last
8 years or so, mostly from FSF/GNU influence) become rather fashionable.

A more general solution (that doesn't depend on that particular method
of parsing the command-line) is to refer to the file by prefixing the
filename with "./" -- thus:

vi ./+CONTENTS

(That is, it's "more general" in that it works for any program, whether
or not it is sensitive to seeing "--" in the command-line.  It also copes
with filenames that begin with "-" as well.  It is "less general" in the
sense that it only works for command-line arguments that correspond to
filenames.)

Cheers,
david
-- 
David Wolfskill		dhw@whistle.com		UNIX System Administrator
voice: (650) 577-7158	pager: (888) 347-0197	FAX: (650) 372-5915


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911251416.GAA02393>