bash-com/write

14 lines
363 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
# (0) Get current ABS directory
ROOT=$(dirname `realpath $0`);
# (1) Check arguments
test $# -lt 2 && echo "ERR: Missing arguments (name, message)" && 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) Write content to file
echo -ne "$2" >> $BUF_OUT;