tar: --exclude option has no effect
Issue
tar
command outputs "--exclude has no effect" error and returns exit code 2 in RHEL8. However, the same command can be executed successfully in RHEL7.
# tar -cpzf /tmp/root.tar.gz root --exclude '.bash*'
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 ‘.bash*’ has no effect
tar: Exiting with failure status due to previous errors
# echo $?
2
Environment
- Red Hat Enterprise Linux 8
- tar 1.30
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.