I'm trying to get into tar file the stdout generated from Mysqldump:
mdm@deb606:~$ mysqldump --opt test1 -u root -ppassword | tar -czf example.tar.gz
doesn't work.
At the moment I've temporary solved using:
mdm@deb606:~$ mysqldump --opt test1 -u root -ppassword | gzip -f > example.gz
Is it possible do the the same using also tar or bzip2?
I don't know that it's possible to pipe directly into tar
(in general, that doesn't make a lot of sense), however the bzip2
command will accept -
to mean to read from stdin, i.e.:
mdm@deb606:~$ mysqldump --opt test1 -u root -ppassword | bzip2 - > example.bz2