Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6569691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:39:49+00:00 2026-05-25T14:39:49+00:00

The script below should open an entry box whose initial entry-text is the value

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:39:50+00:00Added an answer on May 25, 2026 at 2:39 pm

    The notation $(filename) runs a command ‘filename’.

    To expand a variable, use ${filename}.

    Note, too, that unless $filename is an exported variable, the sub-shell (the one that runs the -c option) will not see the value of the variable (because of the single quotes).

    To fix that, you’d have to use double quotes – rather carefully:

    #!/bin/bash
    filename="duck"
    sh -c "chromium-browser \"https://duckduckgo.com/?q=%5C$(zenity --entry --text \"I am feeling ducky\" --entry-text ${filename})\""
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The script below should open all the files inside the folder 'pruebaba' recursively but
The script below will replace selected word in a textarea. But it only works
I've tried the below script but I am getting an error: dim cn, rs
The could below doesnt write to the text file as it should: import re
The script below, test.php, is intended to be placed in a specific directory of
The script below resides in my theme's functions.php file. It is designed to show
The script below worked on my Mac OS X. I'm now using Ubuntu OS,
The jQuery ajax script below doesn't work on my site if url is without
Consider the script below. It will launch two subprocesses, each one a CherryPy app
i am testing with the shell script below: #!/bin/ksh -x instance=`echo $1 | cut

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.