Qvm-run The command does not perceive the variable

I trying open link in VM

qvm-run --pass-io disp666 'torbrowser --new-tab $link'

but just opens a new window with a blank page, as if I created a new window in the browser ctrl+n

Command output (last lines)

+ x-www-browser --new-tab 
+ '[' '!' 0 = 0 ']'
+ exit 0

If let without variables
qvm-run --pass-io disp666 'torbrowser --new-tab https://forum.qubes-os.org/'
then the output is:

+ x-www-browser --new-tab https://forum.qubes-os.org/
+ '[' '!' 0 = 0 ']'
+ exit 0

and the link opens in a new tab

But my script can only take a link from a variable.
I’ve tried different structures with crutches, but the only working way is to write the command to a file and then run that file. But that doesn’t sit well with me. Variables should be stored where they belong - in RAM

Welcome @qubiq to the Qubes-OS world,

try this:

qvm-run disp666 "torbrowser --new-tab $link"
1 Like

Thanks, it work’s!
I followed the instructions on this page qvm-run – Run a command in a specified VM — Qubes Admin client v4.1.17-0-g5a12b9b-dirty documentation
and I don’t fully understand what --pass-io means

I’m also interested in the question…
How can I open a link in the new dispVM?
qvm-run -q -a --service --dispvm=whonix-16-dvm -- qubes.StartApp+janondisttorbrowser+https://forum.qubes-os.org/???

I don’t mind opening the link with the previous command, but I’ll need to additionally extract the dispXXX name from qvm-ls and control when the browser starts because qvm-run --dispvm doesn’t output successfully. So I could initiate the opening of the link after &&
Any ideas?