From 631f0deafc38d245e13e1ccbc2a6076c46eee676 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 18 Sep 2008 17:39:24 +0200 Subject: bin/pkg: Use less external commands --- bin/pkg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pkg b/bin/pkg index 63538ba..4d3b2e1 100755 --- a/bin/pkg +++ b/bin/pkg @@ -76,9 +76,9 @@ if [[ ! -d $PDIR ]] { ## # Protocol -if (grep '^ssh' <<< $PKG_ROOT &> /dev/null) { +if [[ ${PKG_ROOT#ssh} != $PKG_ROOT ]] { PKG_PROTO='ssh' - } elif (grep '^/' <<< $PKG_ROOT &> /dev/null) { +} elif [[ ${PKG_ROOT#'/'} != $PKG_ROOT ]] { PKG_PROTO='file' } else { false @@ -86,12 +86,12 @@ if (grep '^ssh' <<< $PKG_ROOT &> /dev/null) { # Host if [[ $PKG_PROTO = 'ssh' ]] { - PKG_HOST=$(sed 's!^ssh://!!' <<< $PKG_ROOT | sed -r 's!^([^/]*)/.*$!\1!') + PKG_HOST=$(sed -r 's!^([^/]*)/.*$!\1!' <<< ${PKG_ROOT#'ssh://'}) } # Remote path if [[ $PKG_PROTO = 'ssh' ]] { - PKG_PATH=$(sed 's!^ssh://'"$PKG_HOST"'/!!' <<< $PKG_ROOT) + PKG_PATH=${PKG_ROOT#"ssh://$PKG_HOST"} } elif [[ $PKG_PROTO = 'file' ]] { PKG_PATH=$PKG_ROOT } @@ -209,7 +209,7 @@ list_type_local () { list_update_remote () { if [[ $PKG_PROTO = 'ssh' ]] { - scp -q $PKG_HOST:$(cut -d / -f 4- <<< $PKG_ROOT | sed 's!~/!!')/.list .list-remote + scp -q $PKG_HOST:${$(cut -d / -f 4- <<< $PKG_ROOT)/'~/'}/.list .list-remote } elif [[ $PKG_PROTO = 'file' ]] { cp $PKG_ROOT/.list .list-remote } -- cgit v1.2.3