From 7952d6fbfc4f6430e043d65ddf2923ca359cfb73 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 24 Aug 2011 10:18:26 +0200 Subject: checkpkg: Avoid unnecessary use of grep(1)/basename(1) Use parameter expansion instead of invoking external binaries here. Signed-off-by: Lukas Fleischer Signed-off-by: Pierre Schmitz --- checkpkg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'checkpkg') diff --git a/checkpkg b/checkpkg index 9d379b7..f408267 100755 --- a/checkpkg +++ b/checkpkg @@ -52,14 +52,14 @@ for _pkgname in "${pkgname[@]}"; do oldpkg=${pkgurl##*://*/} - if [[ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]]; then + if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then echo "The built package ($_pkgname) is the one in the repo right now!" exit 1 fi if [[ ! -f $oldpkg ]]; then - if echo $pkgurl | grep '^file:///' > /dev/null 2>&1; then - ln -s "${pkgurl#file://}" $(basename "${pkgurl#file://}") + if [[ $pkgurl = file://* ]]; then + ln -s "${pkgurl#file://}" "${pkgurl##file://*/}" elif [[ -f "$PKGDEST/$oldpkg" ]]; then ln -s "$PKGDEST/$oldpkg" "$oldpkg" elif [[ -f "$STARTDIR/$oldpkg" ]]; then -- cgit v1.2.3-24-g4f1b