wget http://example.com/install.sh -O - | bash自动运行脚本,但由于可能的 (TLS) MITM 攻击等,这是不安全的。是否可以构建一个下载脚本的单行,但仅当它的哈希与单行中指定的哈希匹配时才执行它?如果单行可以打印一些类似于Warning! Hash mismatch哈希检查失败的内容,那就太好了。
wget http://example.com/install.sh -O - | bash
Warning! Hash mismatch
command-line bash scripts wget
bash ×1
command-line ×1
scripts ×1
wget ×1