From ab53aa3e3c6370d21ab763210830cd31a5a024a2 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 20 Jun 2011 10:32:12 -0400 Subject: repo-add: use bash equivalents of basename/dirname Signed-off-by: Dave Reisner --- scripts/repo-add.sh.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 6ccefd7b..f3cc1843 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -42,7 +42,7 @@ m4_include(library/output_format.sh) # print usage instructions usage() { - cmd="$(basename $0)" + cmd=${0##*/} printf "%s (pacman) %s\n\n" "$cmd" "$myver" if [[ $cmd == "repo-add" ]] ; then printf "$(gettext "Usage: repo-add [options] ...\n")" @@ -74,7 +74,7 @@ See %s(8) for more details and descriptions of the available options.\n\n")" $cm } version() { - cmd="$(basename $0)" + cmd=${0##*/} printf "%s (pacman) %s\n\n" "$cmd" "$myver" printf "$(gettext "\ Copyright (c) 2006-2011 Pacman Development Team \n\n\ @@ -301,7 +301,7 @@ db_write_entry() # create desc entry msg2 "$(gettext "Creating '%s' db entry...")" 'desc' - echo -e "%FILENAME%\n$(basename "$1")\n" >>desc + echo -e "%FILENAME%\n${1##*/}\n" >>desc echo -e "%NAME%\n$pkgname\n" >>desc [[ -n $pkgbase ]] && echo -e "%BASE%\n$pkgbase\n" >>desc echo -e "%VERSION%\n$pkgver\n" >>desc @@ -373,7 +373,7 @@ db_remove_entry() { mv "$pkgentry/deltas" "$tmpdir/$pkgname.deltas" fi msg2 "$(gettext "Removing existing entry '%s'...")" \ - "$(basename $pkgentry)" + "${pkgentry##*/}" rm -rf $pkgentry pkgentry=$(find_pkgentry $pkgname) done @@ -510,7 +510,7 @@ case "$1" in esac # figure out what program we are -cmd="$(basename $0)" +cmd=${0##*/} if [[ $cmd != "repo-add" && $cmd != "repo-remove" ]]; then error "$(gettext "Invalid command name '%s' specified.")" "$cmd" exit 1 @@ -585,7 +585,7 @@ if (( success )); then "$REPO_DB_FILE" ;; esac - filename=$(basename "$REPO_DB_FILE") + filename=${REPO_DB_FILE##*/} pushd "$tmpdir" >/dev/null if [[ -n $(ls) ]]; then -- cgit v1.2.3-70-g09d2