如何解决base64 解码命令 linux cli 命令
请问除了回显之外,有没有一种方法可以让我捕获文件并检索字符串,然后使用它通过 base64 进行解码?
此命令有效
echo "dctyGqLcE5s+D3gzO9pxQo8C+YABV7SBbfn2jamVzVc=" | base64 --decode > out.txt
我尝试将字符串放在名为 file.text 的文本文件上并将 echo 替换为 cat,但似乎失败了
echo "`cat file.txt`" | base64 --decode > out.txt
错误信息:
base64: invalid input
解决方法
用法:
man base64
base64 file.txt > encoded.txt # to encode
base64 -d encoded.txt > decoded.txt # to decode
你也可以使用
cat file.txt | base64 # to encode
cat encoded.txt | base64 -d # to decode
注意:
如果您收到 base64: INVALID INPUT
错误,则表示您的输入文件不是 base64 编码文件(无法使用 base64 解码)。示例尝试解码您的文本文件。
base64 -d file.txt
输出:
base64: invalid input
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。