Debian Codegraph @

contrib/ls-config/sample/script

raw
1 #!/bin/bash
2
3 #title :script
4 #description :this script only demonstrate usage of ls-config
5 #author :Łukasz A. Grabowski <[email protected]>
6 #date :20130928
7 #version :1.0.3
8 #notes :This only read one value from configuration file
9 # :this script MUST be run from subdirectory of dir
10 # :where ls-config (bin) and lslib-core are stored
11 # :to place script in other places You must reconfigure paths
12 #bash_version :4.2.37(1)-release
13 #copywrite :Copyright (C) 2013 Łukasz A. Grabowski
14 #license :This program is free software: you can redistribute
15 # :it and/or modify it under the terms of the GNU General
16 # :Public License as published by the Free Software
17 # :Foundation, either version 2 of the License or
18 # :any later version.
19 # :
20 # :This program is distributed in the hope that it will
21 # :be useful, but WITHOUT ANY WARRANTY; without even the
22 # :implied warranty of MERCHANTABILITY or FITNESS FOR
23 # :A PARTICULAR PURPOSE. See the GNU General Public
24 # :License for more details.
25 # :
26 # :You should have received a copy of the GNU General
27 # :Public License along with this program. If not, see
28 # :http://www.gnu.org/licenses/.
29 #=======================================================================
30
31
32 #set app flag
33 LS_EXEC=1
34
35 #set configuration directory
36 CFGD="./"
37
38 #source bash library to manipulate config
39 source ../lslib-core
40
41 #path direcrories onlny for this sample
42 PACD="../"
43 LIBD=""
44 #end path
45
46 #read data from configuration file
47 TEST=$(cfg_f_g "config" "info")
48 ERR="$?"
49
50 #show data
51 echo "Info value: $TEST"
52 echo "Reading error: $ERR"
53
54 #show other method of reading value:
55
56 #output space and info
57 echo ""
58 echo "Reading using binary:"
59
60 #read data from configuration file
61 TEST=$(${PACD}ls-config -f config --get="info" -vq)
62 ERR="$?"
63
64 #show data
65 echo "Info value: $TEST"
66 echo "Reading error: $ERR"
67
68 exit 0;