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; }
|
||||
[[ -n "${password}" ]] || { log "ERROR" "No password given"; exit 2; }
|
||||
|
||||
if [[ ! "$size" =~ ^([1-9][0-9]*)?$ ]]; then
|
||||
log "ERROR" "Invalid size '$size', must be empty or a positive number"
|
||||
exit 2
|
||||
fi
|
||||
[[ "$size" =~ ^([1-9][0-9]*)?$ ]] || { log "ERROR" "Invalid size '$size', must be empty or a positive number"; exit 2; }
|
||||
}
|
||||
|
||||
calc_smart_volumes() {
|
||||
|
|
@ -93,10 +89,7 @@ main() {
|
|||
check_dependencies "7z"
|
||||
check_input "$input_file" "$password" "$size"
|
||||
|
||||
if ! mkdir -p "$archive_dir"; then
|
||||
log "ERROR" "Unable to create archive directory"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$archive_dir" || { log "ERROR" "Unable to create archive directory"; exit 1; }
|
||||
|
||||
volumes="$(get_volumes "$input_file" "$size")"
|
||||
archive_name="$(generate_name)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue