getFileValue(): modified to accept a list of candidates
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 19 Oct 2004 23:59:15 +0000 (23:59 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 19 Oct 2004 23:59:15 +0000 (23:59 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1754 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/scripts/functions

index 391961b..e794173 100644 (file)
@@ -452,11 +452,16 @@ function isVserverRunning
     return 0
 }
 
-## Called as 'getFileValue <varname> <filename>'
+## Called as 'getFileValue <varname> <filename>+'
 function getFileValue
 {
-    test -r "$2" || return 0
-    eval read "$1" <"$2"
+    local var=$1
+    local file
+    shift
+
+    findFile file "$@" ''
+    test "$file" -a -r "$file" || return 0
+    eval read "$var" <"$file"
 }
 
 ## Called as 'getFileArray <varname> <filename>'