如何使用 cat 通过 openssl 动态对 stdin 进行 Base64 编码?

nic*_*ick 0 linux command-line openssl

以下命令适用于stdin使用以下命令进行编码echo

echo "abc" | openssl enc -base64
Run Code Online (Sandbox Code Playgroud)

此命令也适用于替换stdinusing中的字符cat

cat | sed 's/a/b/g'
Run Code Online (Sandbox Code Playgroud)

但是,以下应stdin使用编码的命令cat不能满足我的需求,因为它不会在我每次按回车键时显示编码值。

cat | openssl enc -base64
Run Code Online (Sandbox Code Playgroud)

如何stdin使用 进行即时编码cat

Nat*_*han 5

如果您输入

cat | openssl enc -base64
Run Code Online (Sandbox Code Playgroud)

然后按Ctrl+D然后它将对您刚刚输入的所有内容进行编码。