如果出现以下报错,说明 tar 的软件版本是tar (GNU tar) 1.30,需要将--exclude=提到-zcvf前面
tar: The following options were used after any non-optional arguments in archive create or update mode. These options are positional and affect only arguments that follow them. Please, rearrange them properly.
tar: --exclude ‘zidir1’ has no effect
tar: Exiting with failure status due to previous errors
[root@aleng ~]# tar --versiontar(GNU tar)1.26
Copyright (C)2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
[root@aleng ~]# tar --versiontar(GNU tar)1.30
Copyright (C)2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.