Answer the question
In order to leave comments, you need to log in
How to edit the output of the find command?
Hello. I am learning Linux.
Playing around with the Find command. I decided to try the task of creating Cron archives.
I want all Cron directories to be placed in the archive and in the /backup folder. I
came up with this script:
#!/bin/bash
cd /etc
find . -maxdepth 1 -name 'cron*' -type d -exec tar cf /etc/backup/{}.tar.gz {} \;
BUT!
It turns out that the archive is created along this path /etc/backup/./cron.monthly.tar.gz, but it should be /etc/backup/cron.monthly.tar.gz. How to do it? How to remove this extra nesting?
It looks like the answer is somewhere on the surface, but I can not find (((
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question