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
7 # default speed [words/minute]
10 # timeout [sec] for fetch operations
13 # directory for temporary files
17 # directory for text sources
24 # function to read config value by name
25 # arguments: configfile name [separators]
26 # value in stdout, exit nonzero if error
27 # if separators are given, will be replaced by SPC in output
28 # (e.g ',;' will result in returning "a,b;c" as "a b c")
29 # WARNING: DO NOT USE '`' in values or separators!
31 local retline retval separators
32 # check if config file readable, else fail
33 test -r "$1" ||
return 2
34 # get last line with name (possibly surrounded by whitespace)
35 retline
=`grep -i "^[ ]*$2[ ]" "$1"|tail -n 1`
36 # fail if nothing found
37 test "$retline" != "" ||
return 1
38 # if no separators given, replace ' ' with ' ' ie NOP
40 # return second word from read line and substitute separators by SPC
41 echo $retline |
{ read _ retval _
; echo $retval ; } |
42 sed -e "s\`[$separators]\` \`g"