13 lines
250 B
Bash
Executable file
13 lines
250 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
[ -z "$1" ] && ( cat << EOT
|
|
Computes a 'digest-sha1-p3' file identifier from a record identifier.
|
|
|
|
Usage: $0 <identifier>
|
|
EOT
|
|
) && exit 1
|
|
|
|
sha="$(printf '%s' "$1" | sha1sum | cut -d ' ' -f1)"
|
|
printf '%s/%s\n' ${sha:0:3} ${sha:3}
|