Re: ssh-copy-id no newline bug

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



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
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux