什么是 sha1sum "exit codes"?
What are sha1sum "exit codes"?
1) 关于sha1sum"exit codes"有没有documentation/URL?我只是想确定 "exit code 1" 总是意味着有一个 "FAILED result".
$ sha1sum dummy* > SHA1SUM
$ sha1sum -c SHA1SUM
dummy1: OK
dummy2: OK
dummy3: OK
$ echo $?
0
$ ls > dummy1
$ sha1sum -c SHA1SUM
dummy1: FAILED
dummy2: OK
dummy3: OK
sha1sum: WARNING: 1 computed checksum did NOT match
$ echo $?
1
$ ls > dummy2
$ sha1sum -c SHA1SUM
dummy1: FAILED
dummy2: FAILED
dummy3: OK
sha1sum: WARNING: 2 computed checksums did NOT match
$ echo $?
1
退出代码 1
可能意味着其他错误,例如权限失败或文件未找到(尽管这将被计为 FAILED
结果)。
touch foo
sha1sum foo > foo.sha1
mv foo bar
sha1sum foo.sha1 # will fail with $? == 1
1) 关于sha1sum"exit codes"有没有documentation/URL?我只是想确定 "exit code 1" 总是意味着有一个 "FAILED result".
$ sha1sum dummy* > SHA1SUM
$ sha1sum -c SHA1SUM
dummy1: OK
dummy2: OK
dummy3: OK
$ echo $?
0
$ ls > dummy1
$ sha1sum -c SHA1SUM
dummy1: FAILED
dummy2: OK
dummy3: OK
sha1sum: WARNING: 1 computed checksum did NOT match
$ echo $?
1
$ ls > dummy2
$ sha1sum -c SHA1SUM
dummy1: FAILED
dummy2: FAILED
dummy3: OK
sha1sum: WARNING: 2 computed checksums did NOT match
$ echo $?
1
退出代码 1
可能意味着其他错误,例如权限失败或文件未找到(尽管这将被计为 FAILED
结果)。
touch foo
sha1sum foo > foo.sha1
mv foo bar
sha1sum foo.sha1 # will fail with $? == 1