Skip to content
Advertisement

Tar search results in .sh file

I have to tar a list of files, without path, that is a result of a find via sh (for crontab use).

In ubuntu’s shell each command works fine but in .sh not.

I tried with :

JavaScript

And also with

JavaScript

But both failed. May someone help? Alternatives ?

Additional scenario info:

  • /myfolder/ contains:
    • one1.log
    • one2.log
    • one3.log
    • two1.log
    • two2.log
      I want one.tgz containing one1.log, one2.log, one3.log

Advertisement

Answer

I think you are looking to pass the filenames to tar on stdin :

JavaScript

In my case:

JavaScript
Advertisement