From 59da10b03a0ed44446ccd3ae77883175bd3dad34 Mon Sep 17 00:00:00 2001 From: Venkat Date: Mon, 4 Nov 2024 21:47:57 +0530 Subject: [PATCH] Update github-backup.sh --- github-backup.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/github-backup.sh b/github-backup.sh index a35cae8..3079a2a 100755 --- a/github-backup.sh +++ b/github-backup.sh @@ -21,15 +21,34 @@ while true; do if [ -z "$orgs" ]; then break fi - - # Append organizations to the all_orgs variable - all_orgs="$all_orgs,$orgs" + + # Replace newlines with commas in the current page's orgs + orgs_comma=$(echo "$orgs" | paste -sd "," -) + + # Append current orgs to all_orgs with a comma separator + if [ -z "$all_orgs" ]; then + all_orgs="$orgs_comma" + else + all_orgs="$all_orgs,$orgs_comma" + fi # Increment the page number page=$((page + 1)) done +# Save the original IFS +OLD_IFS="$IFS" + +# Set IFS to comma for splitting +IFS=',' + +# Read the all_orgs into positional parameters +set -- $all_orgs + +# Restore the original IFS +IFS="$OLD_IFS" + echo "Full list to be backed up: $all_orgs" for GITHUB_ORG_TO_BACKUP in "$@"; do