From 133b8babd8ae223209681be773a7509b97297724 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 21:57:44 +0200 Subject: [PATCH] =?UTF-8?q?if=20=E2=86=92=20&&?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pidd.sh | 15 ++++++--------- readme.md | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pidd.sh b/pidd.sh index 5c3ce4d..0796472 100644 --- a/pidd.sh +++ b/pidd.sh @@ -372,9 +372,8 @@ Acquire::https::Verify-Peer False; # github → gitea → forgejo if [ -n "${GITHUB_SERVER_URL}" ]; then PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" - if [ -n "${GITHUB_TOKEN}" ]; then + [ -n "${GITHUB_TOKEN}" ] && PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@" - fi PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" else pidd_error_ci "GITHUB_SERVER_URL" @@ -701,11 +700,10 @@ pidd_error_os() { pidd_grep_os() { pidd_grep_os__variable="${1}" - if [ -n "${pidd_grep_os__variable}" ]; then + [ -n "${pidd_grep_os__variable}" ] && grep "^${pidd_grep_os__variable}=" "/etc/os-release" | - sed "s|^${pidd_grep_os__variable}=||" | + sed "s|^${pidd_grep_os__variable}=||" | sed "s|^\"\(.*\)\"$|\1|" - fi } pidd_install_package() { @@ -719,8 +717,8 @@ pidd_ln_python() { pidd_ln_python__command="${1}" if [ -n "${pidd_ln_python__command}" ]; then echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}" - ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" || - exit + ln -f -s "${pidd_ln_python__command}" \ + "/usr/bin/${PIDD_PYTHON_ALIAS}" || exit fi } @@ -770,8 +768,7 @@ pidd_sed() { pidd_cat "${pidd_sed__file}" for pidd_sed__regex in "${@}"; do sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" && - pidd_cat "${pidd_sed__file}" || - exit + pidd_cat "${pidd_sed__file}" || exit done fi } diff --git a/readme.md b/readme.md index ffa663e..23aab04 100644 --- a/readme.md +++ b/readme.md @@ -92,5 +92,4 @@ from various contexts of CA, CI and OCI / OS. ### .sh -* reduce single conditions with && * support opensuse