I have several scripts that run and collect data which is then fed into other scripts. So this entire chain is automated. At one point in the automation, all data files are tarred up to be sent for processing. The command I am using is this:
tar -zchvf "$target_dir" -C "$data_dir" .
Where target_dir is where my tarball is going and data_dir is where my data is located.
Now this is working fine; however, the files in my tarball look like this:
./file1 ./file2 <etc>
The post processing script is messing up because of the leading ./ on these files. It is expecting them to look like this:
file1 file2 <etc>
I have looked at the man page and nothing really stands out to me for removing the leading ./ in the tar process. One thing I was thinking about doing was changing the script to the following...
cd $data_dir; tar -zchvf "$target" *; cd -
but this just feels very wrong to me and I believe there is something else stupid I am missing.
I am using bash v3.2.5 just as reference.