shellcheck

This commit is contained in:
sometimesuseful 2024-11-12 16:04:51 +00:00
parent 8ebb5071a4
commit 96e65508d1

View file

@ -10,7 +10,7 @@ trap 'cleanup' ERR INT
cleanup() {
if [[ -n "$archive" ]]; then
rm -f "${archive}"*
log "INFO" "Cleaning up $(basename $archive) remains before exit"
log "INFO" "Cleaning up $(basename "$archive") remains before exit"
fi
}
@ -55,7 +55,7 @@ set_volumes() {
local volumes=""
if [[ -n "$size" ]]; then
smart_size="$(calc_smart_volumes $input_file $size || echo -n)"
smart_size="$(calc_smart_volumes "$input_file" "$size" || echo -n)"
volumes="-v${smart_size}m"
fi
@ -66,7 +66,7 @@ set_volumes() {
# Generates a random archive name of 20 alphanumeric characters
generate_name() {
archive="$archive_dir/$(tr -dc [:alnum:] < /dev/urandom | head -c 20).7z"
archive="$archive_dir/$(tr -dc '[:alnum:]' < /dev/urandom | head -c 20).7z"
log "INFO" "Generated archive name '$archive'"
@ -100,7 +100,7 @@ main() {
exit 1
fi
volumes="$(set_volumes $input_file $size)"
volumes="$(set_volumes "$input_file" "$size")"
archive="$(generate_name)"
log "INFO" "Packing '${input_file}' into archive '$archive' with password '${archive_pwd}'"