ssh-copy-id no newline bug

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Tue Mar 22 20:12:39 AEDT 2016


On Tue, 22 Mar 2016, Philip Hands wrote:
>
> which means that the second half of the && does not need to be
> evaluated -- the result being that a newline is only added if the last
> character of the file is not already a newline.

Well, then there's the case with the non-existing file and the other
case with an empty file.  What about this:

f=/tmp/ff && >>$f && [ "$(tail -c1 $f)" ] && echo >>$f || :;stat $f

>>$f		# like `touch', but no fork (makes sure the file
		# exists) so `tail' will not fail

tail -c1 $f	# on an empty file will return "" (as if there was a
		# a <newline> there

;stat $f	# is there just to show what's going on


Cheers,

-- 
Cristian


More information about the openssh-unix-dev mailing list