Hi,
As far as I can tell there is a "Here String" bug in Bash that ships with RHEL/OL 8.0
"Here String" is a handy shortcut dealing with input from variables: https://www.tldp.org/LDP/abs/html/x17837.html
I'd say it's a bug because there should be a difference between quoted and unquoted variables, namely that unquoted variables concatenate newline and white space. At first I thought the problem was cksum, but as the cat test below demonstrates, it's the command shell that causes the issue.
I doubt, however, there is much impact. Probably not many people will use unquoted "here string", but nevertheless, the issue could be baffling.
OL 7.7:
[root@vm7031 bin]# bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
[root@vm7031 bin]# cksum < myfile
1573850419 24878
[root@vm7031 bin]# a=$(head -n -1 myfile)
[root@vm7031 bin]# cksum <<< $a
3530052679 22276
[root@vm7031 bin]# cksum <<< "$a"
3911935403 24860
[root@vm7031 bin]# echo $a > 1
[root@vm7031 bin]# echo "$a" > 2
[root@vm7031 bin]# cksum < 1
3530052679 22276
[root@vm7031 bin]# cksum < 2
3911935403 24860
[root@vm7031 bin]# cat <<< $a > 2
[root@vm7031 bin]# cat <<< "$a" > 3
[root@vm7031 bin]# cksum < 2
3530052679 22276
[root@vm7031 bin]# cksum < 3
3911935403 24860
OL 8.0:
[root@localhost bin]# bash --version
GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
[root@localhost bin]# cksum --version
cksum (coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
[root@localhost bin]# cksum < myfile
1573850419 24878
[root@localhost bin]# a=$(head -n -1 myfile)
[root@localhost bin]# cksum <<< $a
3911935403 24860
[root@localhost bin]# cksum <<< "$a"
3911935403 24860
[root@localhost bin]# echo $a > 1
[root@localhost bin]# echo "$a" > 2
[root@localhost bin]# cksum < 1
3530052679 22276
[root@localhost bin]# cksum < 2
3911935403 24860
[root@localhost bin]# cat <<< $a > 2
[root@localhost bin]# cat <<< "$a" > 3
[root@localhost bin]# cksum < 2
3911935403 24860
[root@localhost bin]# cksum < 3
3911935403 24860