Skip to content
Snippets Groups Projects

Implement suggestions from shellcheck

Merged Fjen Undso requested to merge cleanup into master
2 unresolved threads

Script was run through https://www.shellcheck.net/

Some parts were not quoted or could have unwanted side effects like "rm -r /".

Remaining suggestions can be ignored IMO:

Line 106:
    declare -rg date=$(date +"%Y%m%d-%H%M%S")
                ^-- SC2155: Declare and assign separately to avoid masking return values.
 
Line 123:
        for dir in $(ls -t1 "$BACKUP_PATH" | tail -n +"$NUMBACKUPS"); do
                     ^-- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.
 
Line 137:
    if [[ $? -ne 0 ]]; then
          ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
 
Line 153:
        dbs=$(ls ./*.sql | cut -d "." -f 1 | cut -d "-" -f 1 | sort | uniq)
              ^-- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.
 
Line 188:
            [[ $? -ne 0 ]] \
               ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
Edited by Fjen Undso

Merge request reports

Merged by Sven GreinerSven Greiner 3 years ago (Dec 20, 2021 9:05pm UTC)

Merge details

  • Changes merged into with 50033dfb.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
74 74 fi
75 75
76 76 if wants_compression; then
77 require_command ${COMPRESS%% *}
77 require_command "${COMPRESS%% *}"
78 78 fi
79 79
80 80 if wants_encryption; then
81 81 require_command "gpg"
82 82
83 83 if [[ -n "$GPG_KEYID" ]]; then
84 gpg --list-keys $GPG_KEYID &> /dev/null \
84 gpg --list-keys "$GPG_KEYID" &> /dev/null \
  • 244 238 echo -e "USAGE: $0 path/to/config \nOr myftpdumper.conf file in same directory" >&2
    245 239 exit 1
    246 240 fi
    241 # shellcheck source=/dev/null
  • Fjen Undso changed title from Implement suggestions form shellcheck to Implement suggestions from shellcheck

    changed title from Implement suggestions form shellcheck to Implement suggestions from shellcheck

  • Fjen Undso changed the description

    changed the description

  • Author Owner

    @SammysHP merge?

  • merged

  • Sven Greiner mentioned in commit 50033dfb

    mentioned in commit 50033dfb

  • Please register or sign in to reply
    Loading