Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个 bash 命令:
gunzip db.gz | ssh user@host mysql -uroot -ppassword db
它可以工作,但具有解压缩文件的副作用db.gz,然后必须重新压缩。我想保留压缩文件。我做了一个男人'gunzip',但没有看到这样的选择。
db.gz
一种选择是通过网络以压缩形式发送文件,并在接收端解压缩流。
ssh user@host "gunzip | mysql -uroot -ppassword db" < db.gz
再看一下手册页。有一个-kor--keep选项可以做到这一点。手册页说:
-k
--keep
Keep (don't delete) input files during compression or decompression.