Artificial intelligent assistant

Tar command saves file in working directory instead of specified directory I'm trying to make a automatic backup via the tar command: datum=$(date +%F) buweek=backup_$datum snap=snapshot_$datum mkdir /home/user/BackupArchiv/$buweek tar -czvg /home/user/BackupArchiv/snapshots/$snap -f backupfull /home/user/BackupArchiv/$buweek For some reason the backup file gets saved in my working directory, next to the script I execute, instead of the given directory. Edit: Snapshot file now gets created

the argument after option -f is the output path and filename of tar command - citing `man tar` :


Common options:
-C, --directory=DIR
change to directory DIR

-f, --file=ARCHIVE
use archive file or device ARCHIVE


so your correct command should look like:

`tar -czvg /home/user/BackupArchiv/snapshots/$snap -f /home/user/BackupArchiv/$buweek.tar.gz`

or maybe switch the paths since it's unclear what you want to backup and where you want it to end up - my example will generate a file:

`/home/user/BackupArchiv/backup_2020-10-08.tar.gz` for today :)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 46fbc0b158b774f59dcd91c6eca21f57