From f7bacc255c28fc17c599562c2450720dd83ada4f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 9 Oct 2008 11:31:36 +0200 Subject: bin/pkg: Replaced more external programs by zsh-builtins --- bin/pkg | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/bin/pkg b/bin/pkg index f399246..c154649 100755 --- a/bin/pkg +++ b/bin/pkg @@ -68,12 +68,6 @@ export PKG_ROOT ## Warn otherwise ## -# we need sed -r (and sed -i, but not checking for that here) -QUUX=$(sed -r 's/^fo{2}(.)$/quu\1/' <<< foox 2> /dev/null) -if [[ $QUUX != 'quux' ]] { - warn "sed is not working properly. This may produce unexpected behaviour.\n" -} - if [[ ! -d $PDIR ]] { die "$PDIR not found!!\n" } @@ -94,7 +88,7 @@ if [[ ${PKG_ROOT#ssh} != $PKG_ROOT ]] { # Host if [[ $PKG_PROTO = 'ssh' ]] { - PKG_HOST=$(sed -r 's!^([^/]*)/.*$!\1!' <<< ${PKG_ROOT#'ssh://'}) + PKG_HOST=${${PKG_ROOT#'ssh://'}%%/*} } # Remote path @@ -203,11 +197,11 @@ list_incoming () { } list_type () { - grep ^"$1 " $PDIR/.list-remote | cut -d ' ' -f 2 + echo ${$(grep ^"$1 " $PDIR/.list-remote)[2]} } list_type_local () { - grep ^"$1 " $PDIR/.list | cut -d ' ' -f 2 + echo ${$(grep ^"$1 " $PDIR/.list)[2]} } list_update_remote () { @@ -253,11 +247,11 @@ list_remove_package () { } list_local_version () { - grep "^$1 " $PDIR/.list | cut -d ' ' -f 3 + echo ${$(grep "^$1 " $PDIR/.list)[3]} } list_remote_version () { - grep "^$1 " $PDIR/.list-remote | cut -d ' ' -f 3 + echo ${$(grep "^$1 " $PDIR/.list-remote)[3]} } -- cgit v1.2.3