Made if statements more concise
This commit is contained in:
parent
5d9436d92c
commit
3ea5fcfa15
1 changed files with 2 additions and 9 deletions
|
|
@ -19,11 +19,7 @@ check_input() {
|
||||||
|
|
||||||
[[ -e "$input_file" ]] || { log "ERROR" "Input file '${input_file}' does not exist"; exit 2; }
|
[[ -e "$input_file" ]] || { log "ERROR" "Input file '${input_file}' does not exist"; exit 2; }
|
||||||
[[ -n "${password}" ]] || { log "ERROR" "No password given"; exit 2; }
|
[[ -n "${password}" ]] || { log "ERROR" "No password given"; exit 2; }
|
||||||
|
[[ "$size" =~ ^([1-9][0-9]*)?$ ]] || { log "ERROR" "Invalid size '$size', must be empty or a positive number"; exit 2; }
|
||||||
if [[ ! "$size" =~ ^([1-9][0-9]*)?$ ]]; then
|
|
||||||
log "ERROR" "Invalid size '$size', must be empty or a positive number"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
calc_smart_volumes() {
|
calc_smart_volumes() {
|
||||||
|
|
@ -93,10 +89,7 @@ main() {
|
||||||
check_dependencies "7z"
|
check_dependencies "7z"
|
||||||
check_input "$input_file" "$password" "$size"
|
check_input "$input_file" "$password" "$size"
|
||||||
|
|
||||||
if ! mkdir -p "$archive_dir"; then
|
mkdir -p "$archive_dir" || { log "ERROR" "Unable to create archive directory"; exit 1; }
|
||||||
log "ERROR" "Unable to create archive directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
volumes="$(get_volumes "$input_file" "$size")"
|
volumes="$(get_volumes "$input_file" "$size")"
|
||||||
archive_name="$(generate_name)"
|
archive_name="$(generate_name)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue