tag 61530 notabug
close 61530
stop

On 2/15/23 14:28, Andreas Löw wrote:
    Hello,

    I want to check a single file for correct sha256. All the files of my
    directory are included in a sha256 text file named allsha256.

    The sha256sum always checks all files included in the allsha256 file,
    even if I write:

    sha256sum myfile -c allsha256

    It reports a warning 'no correct formatted line was found for myfile'
    and later it reports 'myfile OK'

    Regards,
    Andreas

The *sum utilities always check all files given in a checksum file(s).
That means once you've passed the -c option, the utility will treat all
further arguments as the name of files with checksums - no matter if the
file appears before or after the -c option:

  $ sha256sum README NEWS    > checksum1
  $ sha256sum TODO configure > checksum2
  $ sha256sum checksum1 -c checksum2
  README: OK
  NEWS: OK
  TODO: OK
  configure: OK

To achieve what you want, you have to pass only the checksum line of the
file you want, e.g.:

  $ grep myfile allsha256s | sha256sum -c -
  myfile: OK

Therefore, I'm hereby marking this as not-a-bug in our bug tracker.

Have a nice day,
Berny



Reply via email to