HomeFreeBSD

SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

Description

SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

cd can fail for a variety of reasons: misspelled paths, missing
directories, missing permissions, broken symlinks and more.

If/when it does, the script will keep going and do all its operations in
the wrong directory. This can be messy, especially if the operations
involve creating or deleting a lot of files.

PR: 227109
Submitted by: mat
Sponsored by: Absolight

Details

Provenance
matAuthored on
Parents
rP471271: SC2153: Possible misspelling: PORTNAME may not be assigned, but portname is.
Branches
Unknown
Tags
Unknown