Skip to content

Commit

Permalink
refactor: implemented hints from shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
petrknap committed Nov 13, 2023
1 parent 7c9217a commit 5a07de6
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions bin/clean_backup.bash
Original file line number Diff line number Diff line change
@@ -9,14 +9,14 @@ clean_backup() {
YEAR="${2:0:4}"
shift
FIND="find ${TARGET} -maxdepth 1 -name ${YEAR}-*_*"
for DATE in ${*}
for DATE in "${@}"
do
FIND="${FIND} -not -name ${DATE}_*"
done
if [[ `${FIND} | wc -l` -gt 0 ]]
if [[ $(${FIND} | wc -l) -gt 0 ]]
then
echo -e "\nPress [Enter] to clean backups based on this search:\n\t${FIND}" 1>&2
read
read -r
${FIND} -exec rm -rfv {} \;
fi
}
4 changes: 2 additions & 2 deletions bin/remote_backup.bash
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ bash -c " \
if [[ \"${BACKUP_ID}\" != \"\" ]]; then wget -O- \"https://backup.petrknap.cz/touch.php?id=${BACKUP_ID}\"; fi \
) \
|| ( \
rm "${LAST_WORKING_DIR}"; \
ln -s "${WORKING_DIR}" "${LAST_WORKING_DIR}"; \
rm \"${LAST_WORKING_DIR}\"; \
ln -s \"${WORKING_DIR}\" \"${LAST_WORKING_DIR}\"; \
) \
"
4 changes: 2 additions & 2 deletions roles/Git/files/macros.bash
Original file line number Diff line number Diff line change
@@ -15,9 +15,9 @@ git() {
command echo " You must specify branch as 3rd parameter."
else
MERGED_TO="$3"
for MERGED_BRANCH in `command git branch --merged "$MERGED_TO" | grep -v "$MERGED_TO" | grep -v "master" | grep -v "*"`
for MERGED_BRANCH in $(command git branch --merged "$MERGED_TO" | grep -v "$MERGED_TO" | grep -v "master" | grep -v "\*")
do
read -p "Are you sure you would like to delete $MERGED_BRANCH merged to $MERGED_TO? [Y/n] " CHOICE
read -rp "Are you sure you would like to delete $MERGED_BRANCH merged to $MERGED_TO? [Y/n] " CHOICE
if [[ "$CHOICE" == "Y" ]] || [[ "$CHOICE" == "y" ]] || [[ "$CHOICE" == "" ]]
then
command git branch --delete "$MERGED_BRANCH"

0 comments on commit 5a07de6

Please sign in to comment.