【发布时间】:2013-08-23 02:13:46
【问题描述】:
我想做类似的事情
openssl enc -d -aes256 -in somefile | less
openssl 需要来自stdin 的密码。当涉及到less 时,这一切都会变得一团糟。
有没有办法从交互式命令中获取输出(例如 openssl 要求输入密码)并将输出通过管道传输到 less?
或者有没有更好的使用 bash 脚本的技术?
【问题讨论】:
-
以下方法可行,但我希望找到一种不使用临时文件的方法...
$tmp_file=$(mktemp); openssl enc -d -in somefile > $tmp_file; less $tmp_file; rm $tmp_file -
我一直使用
rsync而不是ssh,并且通常没有问题。当事情确实变得混乱时,这似乎是一个时间问题 - 有一段时间没有发生,但我记得,如果 rsync 在询问密码时速度很慢,事情就会变得混乱。
标签: bash openssl pipe less-unix