To my astonishment, the less command automatically decrypted the contents of doc.gpg and displayed them to me, rather than displaying the raw encrypted contents of the file. This happens only with the "less" command and not with the "cat" command. If "less doc.gpg" is done on a different machine, a command line popup dialog will appear asking for the password.
Could anyone please explain what mechanism is causing gpg to integrate automatically with the "less" command, and what other commands this automatic integration will occur with? Thanks!
You may define an "input preprocessor" for less. Before less opens a
file, it first gives your input preprocessor a chance to modify the way
the contents of the file are displayed...
...To set up an input preprocessor, set the LESSOPEN environment variable
to a command line which will invoke your input preprocessor. This command
line should include one occurrence of the string "%s", which will be
replaced by the filename when the input preprocessor command is
Asked in February 2016Viewed 2,371 timesVoted 4Answered 1 times