From 1874232f982226f0a3e6dc439fbfdee543c96f89 Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 22 Jan 2021 19:03:15 +0000 Subject: [PATCH] Fixing Function --- .bash_aliases | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.bash_aliases b/.bash_aliases index afb305d..b03d724 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -67,22 +67,24 @@ fi # Pull all Git repos in this dir function pullall() { - for dir in */ ; do + for dir in * ; do # Execute in subshell ( cd "$dir" || exit 1 # If it's a git directory, then update it - if test -d .git; then - if [ "$(grep -c "[branch "master"]" .git/config )" -gt 0 ]; then - echo "$dir is a Git repo. Pulling master branch..." && git checkout master && git pull && echo "" - elif [ "$(grep -c "[branch "main"]" .git/config )" -gt 0 ]; then - echo "$dir is a Git repo. Pulling main branch..." && git checkout main && git pull && echo "" - fi + if test -d .git; then + + if ["$(grep -c -i ""master"" $dir/.git/config )"] -gt 0; then + echo "$dir is a Git repo. Pulling master branch..." && git checkout master && git pull && echo "" + + elif ["$(grep -c -i ""main"" $dir/.git/config )"] -gt 0; then + echo "$dir is a Git repo. Pulling main branch..." && git checkout main && git pull && echo "" + fi else echo "$dir is not a Git repo." && echo "" fi ) - done + done } # Updates packages from all sources