diff --git a/src/github/gh-repo-list.sh b/src/github/gh-repo-list.sh index bac9156..deb5b24 100755 --- a/src/github/gh-repo-list.sh +++ b/src/github/gh-repo-list.sh @@ -18,7 +18,7 @@ function list_github_repo() { tmp_file=$(mktemp) # Get all repositories - while [ "$endpoint" ]; do + while [[ "$endpoint" ]]; do repos=$(curl --proto "=https" --tlsv1.2 -sSf -L -H "Authorization: token $GITHUB_TOKEN" "$endpoint") echo "$repos" >> "$tmp_file" diff --git a/src/gitnap/gn-init-git.sh b/src/gitnap/gn-init-git.sh index d53c4f4..040542c 100755 --- a/src/gitnap/gn-init-git.sh +++ b/src/gitnap/gn-init-git.sh @@ -15,14 +15,14 @@ function initialize_git_repo() { git init --initial-branch=main # Check for existing README.md file - if [ ! -f "README.md" ]; then + if [[ ! -f "README.md" ]]; then echo "# $repo" > README.md fi git add README.md # Handle optional language parameter - if [ -n "$1" ]; then + if [[ -n "$1" ]]; then # Language name from parameter language="$1" download_gitignore "$language" @@ -30,7 +30,7 @@ function initialize_git_repo() { fi # Handle optional license parameter - if [ -n "$2" ]; then + if [[ -n "$2" ]]; then # License type from parameter license="$2" download_license "$license" diff --git a/src/utils/endpoints.sh b/src/utils/endpoints.sh index 7c4609d..4dcbbe4 100755 --- a/src/utils/endpoints.sh +++ b/src/utils/endpoints.sh @@ -22,7 +22,7 @@ function build_bb_endpoint() { repo="$3" if [[ -z "$route" || -z "$owner" || -z "$repo" ]]; then - echo "Error: route, owner, and repository are required for Bitbucket." + echo "Error: route, owner, and repository are required for Bitbucket." >&2 exit 1 fi @@ -58,7 +58,7 @@ function build_gh_endpoint() { repo="$3" if [[ -z "$route" || -z "$owner" || -z "$repo" ]]; then - echo "Error: route, owner, and repository are required for GitHub." + echo "Error: route, owner, and repository are required for GitHub." >&2 exit 1 fi @@ -95,7 +95,7 @@ function build_gl_endpoint() { slash_encoded="%2F" if [[ -z "$route" || -z "$owner" || -z "$repo" ]]; then - echo "Error: route, owner, and repository are required for Gitlab." + echo "Error: route, owner, and repository are required for Gitlab." >&2 exit 1 fi