summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2013-08-12 14:03:34 +0200
committerFlorian Bruhin <git@the-compiler.org>2013-08-12 14:07:15 +0200
commitf43ba16be644a4f0660636a2fa98e95498004905 (patch)
tree24a2f7ce1048b5490c3de7a8b6aec98f85d49916
parent178da25bc11a7550e034242d55529e287a1cb3da (diff)
downloadsshtunnel-f43ba16be644a4f0660636a2fa98e95498004905.tar.gz
sshtunnel-f43ba16be644a4f0660636a2fa98e95498004905.zip
Try not closing pipev0.02
Conflicts: sshtunnel
-rwxr-xr-xsshtunnel12
1 files changed, 9 insertions, 3 deletions
diff --git a/sshtunnel b/sshtunnel
index a6b5daa..83b405b 100755
--- a/sshtunnel
+++ b/sshtunnel
@@ -45,14 +45,20 @@ conf_section() {
# $2: name of the key
# $3: default value (optional)
conf_key() {
+ local found
(( $# < 2 )) && return 2
+ found=0
while read -r line; do
key="${line%%=*}"
val="${line#*=}"
- [[ "$key" == "$2" ]] && echo "$val" && return 0
+ [[ "$key" == "$2" ]] && echo "$val" && found=1
done < <(conf_section "$1")
- [[ "$3" ]] && echo "$3"
- return 1
+ if (( found == 1 )); then
+ return 0
+ else
+ [[ "$3" ]] && echo "$3"
+ return 1
+ fi
}
# Gets all sections from the config