2018-01-27 17:57:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# (0) Get current ABS directory
|
|
|
|
ROOT=$(dirname `realpath $0`);
|
|
|
|
|
|
|
|
# (1) Check arguments
|
|
|
|
test $# -lt 1 && echo "ERR: Missing arguments (name)" && exit 1;
|
|
|
|
|
2018-01-28 15:58:24 +00:00
|
|
|
# (2) Manage optional argument #
|
|
|
|
FLUSH=1;
|
|
|
|
test $# -ge 2 -a "$2" = "-" && FLUSH=0;
|
|
|
|
|
2018-01-27 17:57:57 +00:00
|
|
|
# (2) load configuration file
|
2018-01-29 12:33:47 +00:00
|
|
|
test -f $ROOT/config/$1 && source $ROOT/config/$1 || ( echo "ERR: No such name" && exit 1 ) || exit 1;
|
2018-01-27 17:57:57 +00:00
|
|
|
|
|
|
|
# (3) Read content from file
|
|
|
|
cat $BUF_IN;
|
|
|
|
|
|
|
|
# (4) Flush buffer
|
2018-01-28 15:58:24 +00:00
|
|
|
test $FLUSH -eq 1 && echo -ne "" > $BUF_IN;
|