Simple Note System v2.0a2
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.
This commit is contained in:
33
functions/create.sns.sh
Normal file
33
functions/create.sns.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#==========================================================================
|
||||
# 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
|
||||
Reference in New Issue
Block a user