Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I must use tar with -T - and get backed up file list from stdin. Untoftunately when input list is empty, tar creates empty archive. I want prevention to this.

It is possible induce tar to do "Cowardly refusing to create an empty archive" instead creating empty archive with -T - option?

I know, I can examine archive is empty by simply call

tar tvF|head -n 1|grep -c ^       #we are interested in only first file exists or not

then decide remove empty or not.

But I want more elegant solution

share|improve this question

You must log in to answer this question.

Browse other questions tagged .