我有一个需要加密的 bash 脚本(在没有人看到代码的情况下运行脚本。)。
我尝试过使用命令加密
openssl enc -e -aes-256-cbc -a -in test.sh > testing
。
我可以使用命令执行脚本:
openssl enc -e -aes-256-cbc -a -in testing -pass pass:<password> | sh -
但是我的脚本也需要参数,如何将参数传递给加密脚本?
原执行方法:
sh test.sh 1 a 23
如何使用参数“1 a 23”执行加密脚本?
如有任何帮助,我们将不胜感激。预先感谢。
您可以明确告诉
sh
从标准输入读取命令,并指定参数:
openssl ... | sh -s 1 a 23