diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-04-01 14:03:51 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-04-01 14:03:51 +0200 |
commit | de9c1794db7419da642398ac41975a282ca92dd1 (patch) | |
tree | 68d1306fe506559eb44b103ec88e86ab357fcd33 /utils.sh | |
parent | 0b0dafd700dce8ab635038dac68255be1897eb04 (diff) |
all
Diffstat (limited to 'utils.sh')
-rw-r--r-- | utils.sh | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -1,17 +1,19 @@ #!/bin/bash -function check_dest { - if ! [ -d $PREFIX ]; then - if ! mkdir -p $PREFIX; then +check_dest() +{ + if ! [ -d "$PREFIX" ]; then + if ! mkdir -p "$PREFIX"; then echo "Could not create target directory '$PREFIX'! Aborting..." exit 1 fi fi } -function run_cmd { - local cmd=$1 - local title=$2 +run_cmd () +{ + local cmd="$1" + local title="$2" if ! eval $cmd >>$LOG 2>&1 ; then printf "%25s%15s\n" "'$title'" "FAIL" @@ -21,5 +23,14 @@ function run_cmd { } +abs_path() +{ + local path="$1" + case "$path" in + /*) absolute=1 ;; + *) absolute=0 ;; + esac +} + check_dest source ~/.bashrc |