From 7965557b65883a6b91de61374764dab1fac778d4 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 26 May 2012 15:41:58 -0400 Subject: functions: style nits Avoid using compound commands where one side runs a command group. Signed-off-by: Dave Reisner --- functions | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/functions b/functions index 64de5b2..262a08a 100644 --- a/functions +++ b/functions @@ -386,7 +386,9 @@ add_dir() { # $1: pathname on initcpio # $2: mode (optional) - { (( ! $# )) || [[ $1 != /?* ]]; } && return 1 + if [[ -z $1 || $1 != /?* ]]; then + return 1 + fi local path=$1 mode=${2:-755} @@ -430,7 +432,10 @@ add_file() { # determine source and destination local src=$1 dest=${2:-$1} mode= - [[ -f $src ]] || { error "file not found: \`%s'" "$src"; return 1; } + if [[ ! -f $src ]]; then + error "file not found: \`%s'" "$src" + return 1 + fi mode=${3:-$(stat -c %a "$src")} if [[ -z $mode ]]; then @@ -499,7 +504,10 @@ add_binary() { binary=$1 fi - [[ -f $binary ]] || { error "file not found: \`%s'" "$1"; return 1; } + if [[ ! -f $binary ]]; then + error "file not found: \`%s'" "$1" + return 1 + fi dest=${2:-$binary} mode=$(stat -c %a "$binary") -- cgit v1.2.3-24-g4f1b