Angelniu Angelniu - 2 months ago 12
Bash Question

shell script "tar" error while running in jinja2

While running shell script in jinja2, I'm getting some errors.
Commond is:

resultFilesPath=/var/data/output
cd $resultFilesPath;
tar czvf {% for tar_file in outputs.output %}{{ tar_file.path }} ./* {% endfor %};


error is:


tar: Old option 'f' requires an argument.

Try 'tar --help' or 'tar --usage' for more information.


I don't know the reason, please help me.

Answer

As stated in the error. Look at the man page for tar. The option f requires you to specify the target archive file name:

tar czvf archive.tar.gz {% for tar_file in outputs.output %}{{ tar_file.path }} ./* {% endfor %};