Qvm-backup-restore fail (following arguments are required: backup_location)

Hi all

I’m trying to pass an argument to qvm-backup-restore as the backup location using

qvm-run -p backup 'ls $HOME/QubesBackup/* -t | head -1'

the command above will return the full path and filename of the last backup i made - works great.

but when i try to pipe that as an argument like this.

qvm-backup-restore --verify-only -d backup | qvm-run -p backup 'ls $HOME/QubesBackup/* -t | head -1'

it fails. it appears that qvm-backup restore executes then the qvm-run command executes.

qvm-backup-restore: error: the following arguments are required: backup_location

I suspect I’m doing something wrong that’s simple to fix, but im no linux expert.

Any help would be appreciated

Pipes work like this:
cmd1|cmd2 takes the output of cmd1 and feeds it as input to cmd2.

So what you are doing is running qvm-backup-restore --verify-only -d backup, and feeding the output of that command in to qvm-run.

What you want to do is take the output of head and use that in qvm-backup-restore.

Thanks for the pointer unman!

This works.

qvm-run --pass-io backup 'ls $HOME/QubesBackup/* -t | head -1' | qvm-backup-restore -p passphrase.txt --verify-only -d backup $(head)