Web lists-archives.com

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




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.