scripts/shell/reporefresh.sh
2024-09-14 10:36:19 -05:00

24 lines
434 B
Bash
Executable file

#!/usr/bin/env bash
#
# SPDX-License-Identifier: MIT
# parent tree of repos
WDIR="/home/user/gitrepos"
function reporefresh() {
for repo in [a-z]*; do
if [[ -d "${repo}/.git" && ! -L "${repo}" ]]; then
pushd "$(pwd)" >/dev/null || return
cd "${repo}" && echo "${repo}"
git pull
popd >/dev/null || return
sleep 1
fi
done
}
cd "${WDIR}" || exit 1
echo "Refreshing ${WDIR}"
reporefresh
echo