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:
30
functions/edit.sns.sh
Normal file
30
functions/edit.sns.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#==========================================================================
|
||||
# Subection: Edit
|
||||
#==========================================================================
|
||||
if [ "$EDIT" == "TRUE" ]; then
|
||||
if [ -r "$NOTE" -o -r ${NOTE%.*} ]; then
|
||||
if [ -z "$CREATE" ]; then
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
TMP_NAME=$ROOTDIR/tmp/$RANDOM
|
||||
openssl enc -d -aes-256-cbc -in ${NOTE%.*} -pass pass:$ENC_KEY > $TMP_NAME
|
||||
echo "" >> $TMP_NAME
|
||||
echo "EDIT $(date)" >> $TMP_NAME
|
||||
else
|
||||
echo "" >> $NOTE
|
||||
echo "EDIT $(date)" >> $NOTE
|
||||
fi
|
||||
fi
|
||||
$EDITOR $NOTE
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
openssl enc -aes-256-cbc -salt -in $NOTE -out ${NOTE%.*} -pass pass:$ENC_KEY
|
||||
rm $NOTE
|
||||
fi
|
||||
|
||||
else
|
||||
echo ""
|
||||
echo "ERROR: Note cannot be opened for editting."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user