Changes: Split script into several different files for easier editting Added build.sh to compile Simple Note System from tree Changed config file to config folder; $HOME/.sns now contains configuration and notes Testing: Script runs and produces help screen; no further testing done.
34 lines
775 B
Bash
34 lines
775 B
Bash
#==========================================================================
|
|
# Subection: Create
|
|
#==========================================================================
|
|
if [ -z "$CREATE" -a -z "$EDIT" -a -z "$PRINT" ]; then #If no action specified, print help and exit
|
|
help
|
|
exit
|
|
else
|
|
|
|
|
|
if [ "$CREATE" == "TRUE" ]; then
|
|
if [ -e $NOTE -o -e ${NOTE%.*} ]; then
|
|
|
|
echo ""
|
|
echo "ERROR: Note already exists"
|
|
echo "Hint: use -e to edit the note."
|
|
echo ""
|
|
exit
|
|
else
|
|
#Create any necessary folders
|
|
mkdir -p $NOTEDIR
|
|
|
|
#Fill in title
|
|
echo "TITLE: $NAME" > $NOTE
|
|
#Fill the second line with the date
|
|
echo "DATE: $(date)" >> $NOTE
|
|
|
|
if [ "$ENCRYPTION" == "TRUE" ]; then
|
|
if [ $EDIT == "FALSE" ]; then
|
|
openssl enc -aes-256-cbc -salt -in $NOTE -out ${NOTE%.*} -pass pass:$ENC_KEY
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|