I want to decrypt the selected text if the string “—–BEGIN PGP MESSAGE—–” occurs in the selected text.
I have the following code but it doesn’t show up anything.
#!/bin/bash
xsel > pgp.txt
if [grep -e "-----BEGIN PGP MESSAGE-----" pgp.txt]
then
gnome-terminal --command "gpg -d -o decrypted.txt pgp.txt"
gedit decrypted.txt
fi
When I run it on terminal after selecting a text it says
line 3: [grep: command not found
I’m new to bash scripting.Any help would be appreciated..
Thank you
It searches an executable called
[grepasifargument.ifexecutes its then or else branch depending if its argument execute successfully or not. Yes,[is a command (synonym fortestbtw). You probably want(added
-qsogrepdoesn’t output anything.)