simplified constant definitions, started examples
[ambros.git] / src / constants.sh
blobadd258b5d31c12a556da5283681629138b27c213
1 #!/bin/sh
2 # functions, strings and other constants for shell scripts
4 # for relation between dit unit and speed in words/min
5 # VVVVV=64, CODEX=60, PARIS=50
6 SPEEDBASE=50
7 # default speed [words/minute]
8 DEFAULTWPM=12
10 # timeout [sec] for fetch operations
11 FETCHTIMEOUT=50
13 # function to read config value by name
14 # arguments: configfile name
15 # value in stdout, exit nonzero if error
16 configread () {
17 local retline retval
18 # check if config file readable, else fail
19 test -r "$1" || return 2
20 # get last line with name (possibly surrounded by whitespace)
21 retline=`grep -i "^[ ]*$2[ ]" "$1"|tail -n 1`
22 # fail if nothing found
23 test "$retline" != "" || return 1
24 # return second word from read line
25 echo $retline | { read _ retval _ ; echo $retval ; }