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

  • SEARCH
  • Home
  • 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 975227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:33:11+00:00 2026-05-16T03:33:11+00:00

When you double-click a bash script, Ubuntu asks if the user wants to Display,

  • 0

When you double-click a bash script, Ubuntu asks if the user wants to Display, Run, or Run In Terminal…

Is there a way within the script to determine if the user chose “Run In Terminal”?

  • 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-16T03:33:12+00:00Added an answer on May 16, 2026 at 3:33 am

    Strictly speaking, you can’t tell whether the user chose “Run In Terminal” after clicking on the script, or fired up a terminal and ran the script from there. But the commands below should help you, especially [ -t 2 ].

    if [ -t 1 ]; then
      echo "Standard output is a terminal."
      echo "This means a terminal is available, and the user did not redirect the script's output."
    fi
    
    if [ -t 2 ]; then
      echo "Standard error is a terminal." >&2
      echo "If you're going to display things for the user's attention, standard error is normally the way to go." >&2
    fi
    
    if tty >/dev/null; then
      echo "Standard input is a terminal." >$(tty)
      echo "The tty command returns the name of the terminal device." >$(tty)
    fi
    
    echo "This message is going to the terminal if there is one." >/dev/tty
    echo "/dev/tty is a sort of alias for the active terminal." >/dev/tty
    if [ $? -ne 0 ]; then
      : # Well, there wasn't one.
    fi
    
    if [ -n "$DISPLAY" ]; then
      xmessage "A GUI is available."
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NSResponder seems to have no mouse double click event. Is there an easy way
Is there a way to set a mouse click or double-click handled in a
I have a small problem with double-click handling with icefaces. There are two methods
Is there any event which fires on double-click event on WPF Window border? How
How can i avoid the double click on a DropDownButton used within a DataGridView
I want to check when the user double click on applictaion icon that no
I am looking for a way to double-click on file name in Windows Explorer
When you double-click on a Word document, Word is automatically run and the document
I want to disable double click for some elements and the best way would
Sometimes when we double click on a USB drive in Windows File Explorer there

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.