i've been writing into a text file, using gedit. today i decided it will be a good idea to password protect it. i've searched quite a bit on google, and finally came up with this solution, which actually is quite nice, i'm referring to @parto's answer, which includes enabling the external tools and adding some scripts. i did everything as written there, including using the proposed CTRL+SHIFT+E/D shortcuts, now, when i activate the encryption, it works as expected and i can save the file regularly, the thing is, that when i try to open it, after i type in the password, it creates a new file instead of replacing the current one. (I did choose the replace current file at the output option..) another curious thing is - for example my starting file name was - EmptyDocument, when i opened it, a new file called EmptyDocu was created, i examined it a bit further and when i encrypt that file and try to open it, a new file called Empty was created, and after that a file called Deskt, which got me thinking there must be something wrong with the script.. the answer is for two years ago, so maybe something has changed in the way this should be written.. unfortunately i was unsuccessful at finding an answer. so i decided to reach out and maybe someone here can help.. the script i copied is:
#!/bin/bash
stdin=$(cat)
if [ "${stdin:0:27}" == "-----BEGIN PGP MESSAGE-----" ]; then
echo "$stdin" | gpg -d --no-tty - 2> /dev/null
else
echo "$stdin"
fi
i also tried adding -o - after 2> /dev/null (i read at the gpg manual that - is for stdout..)
well, here's hoping for the best.
gpg -c mytextfile
. Job done. – Paul Benson Dec 02 '19 at 16:48