This question already has an answer here:

I read an interesting article about securely inputing secret info into a command using pass (a wrapper for GnuPG) and environment variables in Linux; but in order to do this one needs to use environment variables.

How secure are environment variables and in what scopes can access to them be secured?

marked as duplicate by Steffen Ullrich, forest, ThoriumBR, DKNUCKLES, Tobi Nary Aug 24 '18 at 8:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.