Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

xfce-terminal new window at random location plus echo that value

I want to spawn new xfce-terminal windows and run some arbitrary code. I can get it to generate a random number and use that as the X coordinate for the window location, but I would like to also pass the value and have it (for example) print it in the new window.

So if I have:

TEST=$(( $RANDOM % 100 + 20 ))
xfce4-terminal --geometry 160x40+$TEST+40 -e 'bash -c "echo the number is $TEST; bash"'

It correctly creates the window at the random location, but the terminal output in the new window is "the number is " without the value attached.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Any insight appreciated, thanks.

>Solution :

Single quotes don’t allow variable expansions. Use double quotes instead (which requires switching to single quotes on the inside).

... -e "bash -c 'echo the number is $TEST; bash'"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading