bash-com/read

17 lines
384 B
Plaintext
Raw Normal View History

#!/bin/bash
# (0) Get current ABS directory
ROOT=$(dirname `realpath $0`);
# (1) Check arguments
test $# -lt 1 && echo "ERR: Missing arguments (name)" && exit 1;
# (2) load configuration file
test -f $ROOT/config_$1 && source $ROOT/config_$1 || ( echo "ERR: No such name" && exit 1 ) || exit 1;
# (3) Read content from file
cat $BUF_IN;
# (4) Flush buffer
echo -ne "" > $BUF_IN;