Question

The script below should open an entry box whose initial entry-text is the value of $filename, but the zenity section in the third line ignores that variable and I end up with no entry-text.

By the way, if I just replace filename by whoami, my username will appear as expected. I'm not able to get a result using my own variables, though. That's the problem.

#!/bin/bash
filename="duck"
sh -c 'chromium-browser "https://duckduckgo.com/?q=%5C$(zenity --entry --text "I am feeling ducky" --entry-text $(filename))"'

And if I removed the sh -c stuff, to end up with the code below, my variable would work with zenity.

#!/bin/bash
filename="duck"
zenity --entry --text "I am feeling ducky" --entry-text $filename

Any clues as to why? I tried playing with different combination of quotes but my efforts were futile.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top