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


Groups > linux.debian.user > #201634

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

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups linux.debian.user
Subject Re: a quick tip that sometimes saves a lot of further worries
Date 2018-10-25 21:40 +0200
Message-ID <wMTE5-2PU-1@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>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

A "clever" version of this part of the function that does something
similar in a more compact form is:

tail -n +1 -- "$@"

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.

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