View Full Version : What's wrong with this tar command?

24th March 2012, 03:53 PM
Run from a script

I get the following greeting:

tar: You may not specify more than one `-Acdtrux' or `--test-label' option
Try `tar --help' or `tar --usage' for more information.

In the script ...

BACKUP_NAME="scripts-`date +%Y%m%d`.tar.gz"

24th March 2012, 03:58 PM
Nothing that I can tell. It works on mine with

I set the variables to have the same name as yours as well. Perhaps it is a file in the dir it does not like?

24th March 2012, 04:01 PM
Dunno. Baffling the heck out of me. I could have sworn that it worked fine earlier today. Now I changed -czvf to -zvcf and it works. That can't be the trouble, could it?

Error messages are so cryptic sometimes, aren't they?

Here's the complete script as it stands now.

# - bup.sh
# - A script to backup scripts
# - Glenn A. Johnson - November 27, 2011
# - Last edited March 24, 2012
BACKUP_NAME="scripts-`date +%Y%m%d`.tar.gz"
# - Must be root user to run script
if [[ $EUID -ne 0 ]] ; then
echo "You need to run this script with root permissions"
exit 1
# - Source my include files
. includes
. scolors
# - Run the backup archiving all files in the current folder
# - Finish up and exit
echo -e ${txtgrn}"Backup file ${txtred}$BACKUP_NAME ${txtgrn}created.\nScript run completed."${txtrst}
exit 0