diff options
author | Andres P <aepd87@gmail.com> | 2010-05-22 07:06:52 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-05-25 04:23:55 +0200 |
commit | ae73d756607edc8733ddb5facc7066316c34d11f (patch) | |
tree | 4b403721697ce9b744bec590eb0a8a9cb37293a5 | |
parent | 3cd237dec34801963b8cd522038e1a86948d2c91 (diff) | |
download | pacman-ae73d756607edc8733ddb5facc7066316c34d11f.tar.gz pacman-ae73d756607edc8733ddb5facc7066316c34d11f.tar.xz |
makepkg: replace unnecessary uses of grep
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index dec771ee..8c0da8be 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -318,12 +318,12 @@ download_file() { local dlfile="${url##*/}" # replace %o by the temporary dlfile if it exists - if echo "$dlcmd" | grep -q "%o" ; then + if [[ $dlcmd = *%o* ]]; then dlcmd=${dlcmd//\%o/\"$file.part\"} dlfile="$file.part" fi # add the URL, either in place of %u or at the end - if echo "$dlcmd" | grep -q "%u" ; then + if [[ $dlcmd = *%u* ]]; then dlcmd=${dlcmd//\%u/\"$url\"} else dlcmd="$dlcmd \"$url\"" @@ -1107,7 +1107,7 @@ create_srcpackage() { fi done - local install_files=( $(grep "^[[:space:]]*install=" "$BUILDSCRIPT" | sed "s/install=//") ) + local install_files=( $(sed -n "s/^\([[:space:]]*\)install=/\1/p" "$BUILDSCRIPT") ) if [[ -n $install_files ]]; then local file for file in ${install_files[@]}; do @@ -1120,7 +1120,7 @@ create_srcpackage() { done fi - local changelog_files=( $(grep "^[[:space:]]*changelog=" "$BUILDSCRIPT" | sed "s/changelog=//") ) + local changelog_files=( $(sed -n "s/^\([[:space:]]*\)changelog=/\1/p" "$BUILDSCRIPT") ) if [[ -n $changelog_files ]]; then local file for file in ${changelog_files[@]}; do @@ -1250,7 +1250,7 @@ check_sanity() { fi done - local install_files=( $(grep "^[[:space:]]*install=" "$BUILDSCRIPT" | sed "s/install=//") ) + local install_files=( $(sed -n "s/^\([[:space:]]*\)install=/\1/p" "$BUILDSCRIPT") ) if [[ -n $install_files ]]; then local file for file in ${install_files[@]}; do @@ -1263,7 +1263,7 @@ check_sanity() { done fi - local changelog_files=( $(grep "^[[:space:]]*changelog=" "$BUILDSCRIPT" | sed "s/changelog=//") ) + local changelog_files=( $(sed -n "s/^\([[:space:]]*\)changelog=/\1/p" "$BUILDSCRIPT") ) if [[ -n $changelog_files ]]; then for file in ${changelog_files[@]}; do # evaluate any bash variables used @@ -1572,7 +1572,7 @@ OPT_LONG="$OPT_LONG,source,syncdeps,version,config:" # Pacman Options OPT_LONG="$OPT_LONG,noconfirm,noprogressbar" OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')" -if echo "$OPT_TEMP" | grep -q 'PARSE_OPTIONS FAILED'; then +if [[ $OPT_TEMP = *'PARSE_OPTIONS FAILED'* ]]; then # This is a small hack to stop the script bailing with 'set -e' echo; usage; exit 1 # E_INVALID_OPTION; fi |