Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #201635

Re: a quick tip that sometimes saves a lot of further worries

From Étienne Mollier <etienne.mollier@mailoo.org>
Newsgroups linux.debian.user
Subject Re: a quick tip that sometimes saves a lot of further worries
Date 2018-10-25 21:50 +0200
Message-ID <wMTNL-2Te-5@gated-at.bofh.it> (permalink)
References <wMQmR-11H-1@gated-at.bofh.it> <wMTkK-2JO-5@gated-at.bofh.it> <wMTup-2MM-3@gated-at.bofh.it> <wMTE5-2PU-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 10/25/18 9:35 PM, Greg Wooledge wrote:
> On Thu, Oct 25, 2018 at 09:21:27PM +0200, Étienne Mollier wrote:
>> 		for arg in "$@"
>> 		do
>> 			if [ -f "$arg" ]
>> 			then
>> 				printf '<<< %s >>>\n' "$arg"
>> 				cat "./$arg"
> The ./ breaks the function if you give it absolute pathnames.  Replace
> this last line with cat -- "$arg" instead.

Whoopsie!  Indeed.
Got the brain messed with some ./--help file to remove, again...
And since some programs don't (didn't) implement "--", well the
broken solution went first...

> A "clever" version of this part of the function that does something
> similar in a more compact form is:
> 
> tail -n +1 -- "$@"

That's neat!  :-D
It may spew a few errors if for some reason, options are passed to
the editor, and is a little less flexible if we want to add, say
date information, nevertheless cool!

> I didn't write that and can't claim credit for it, but I don't know who
> did, so I can't give appropriate credit either.

I suppose those gentlemen can earn a bit of credit for having
implemented it in "tail" in the first place then, if I trust the
manual:
> AUTHOR
>        Written by Paul Rubin, David MacKenzie, Ian  Lance  Tay‐
>        lor, and Jim Meyering.

Kind Regards,
-- 
Étienne Mollier <etienne.mollier@mailoo.org>

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

a quick tip that sometimes saves a lot of further worries songbird <songbird@anthive.com> - 2018-10-25 18:10 +0200
  Re: a quick tip that sometimes saves a lot of further worries Nicholas Geovanis <nickgeovanis@gmail.com> - 2018-10-25 21:20 +0200
    Re: a quick tip that sometimes saves a lot of further worries Étienne Mollier <etienne.mollier@mailoo.org> - 2018-10-25 21:30 +0200
      Re: a quick tip that sometimes saves a lot of further worries Greg Wooledge <wooledg@eeg.ccf.org> - 2018-10-25 21:40 +0200
        Re: a quick tip that sometimes saves a lot of further worries Étienne Mollier <etienne.mollier@mailoo.org> - 2018-10-25 21:50 +0200
        Re: a quick tip that sometimes saves a lot of further worries songbird <songbird@anthive.com> - 2018-10-26 05:10 +0200
      Re: a quick tip that sometimes saves a lot of further worries songbird <songbird@anthive.com> - 2018-10-26 05:10 +0200
    Re: a quick tip that sometimes saves a lot of further worries songbird <songbird@anthive.com> - 2018-10-26 00:00 +0200

csiph-web