aboutsummaryrefslogtreecommitdiff
path: root/contrib/ls-config/sample/script
blob: 70fe12443ab7c76d5873b31c22dddd80f01c1aa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash

#title          :script
#description    :this script only demonstrate usage of ls-config 
#author         :Łukasz A. Grabowski <www@lucas.net.pl>
#date           :20130928
#version        :1.0.3
#notes          :This only read one value from configuration file
#               :this script MUST be run from subdirectory of dir
#               :where ls-config (bin) and lslib-core are stored
#               :to place script in other places You must reconfigure paths
#bash_version   :4.2.37(1)-release
#copywrite      :Copyright (C) 2013 Łukasz A. Grabowski
#license        :This program is free software: you can redistribute 
#               :it and/or modify it under the terms of the GNU General
#               :Public License as published by the Free Software
#               :Foundation, either version 2 of the License or 
#               :any later version.
#               :
#               :This program is distributed in the hope that it will
#               :be useful, but WITHOUT ANY WARRANTY; without even the
#               :implied warranty of MERCHANTABILITY or FITNESS FOR
#               :A PARTICULAR PURPOSE. See the GNU General Public
#               :License for more details.
#               :
#               :You should have received a copy of the GNU General
#               :Public License along with this program. If not, see 
#               :http://www.gnu.org/licenses/.
#=======================================================================


#set app flag
LS_EXEC=1

#set configuration directory
CFGD="./"

#source bash library to manipulate config
source ../lslib-core

#path direcrories onlny for this sample
PACD="../"
LIBD=""
#end path

#read data from configuration file
TEST=$(cfg_f_g "config" "info")
ERR="$?"

#show data
echo "Info value: $TEST"
echo "Reading error: $ERR"

#show other method of reading value:

#output space and info
echo ""
echo "Reading using binary:"

#read data from configuration file
TEST=$(${PACD}ls-config -f config --get="info" -vq)
ERR="$?"

#show data
echo "Info value: $TEST"
echo "Reading error: $ERR"

exit 0;