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 6318987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:43:32+00:00 2026-05-24T15:43:32+00:00

My goal is to open a new terminal window, SSH into a remote machine

  • 0

My goal is to open a new terminal window, SSH into a remote machine in that window, prompt the user to continue, and then execute a command. I currently have:

gnome-terminal -t "MyWin" -x bash -c "ssh -X $USER@$REMOTE_IP 'echo \"Press ENTER to continue\" ; read JUNK ; echo \"HELLO\" > hello.txt ; bash '"

This works and achieves my primary goal.

The problem is that if the user attempts to exit the script via Control-C while waiting at the “Press ENTER…” prompt, the remainder of the command is executed (e.g., hello.txt appears on the remote machine).

Any thoughts on why this is happening and how to avoid it?

Thanks!

  • 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-24T15:43:36+00:00Added an answer on May 24, 2026 at 3:43 pm

    CtrlC kills the read command, not everything there, so the next command gets executed. You can use && operator to signify that the next command should be executed only if the current one exits successfully.

    gnome-terminal -t "MyWin" -x bash -c "ssh -X $USER@$REMOTE_IP 'echo \"Press ENTER to continue\" ; read JUNK && echo \"HELLO\" > hello.txt ; bash '"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to open a new window when the user clicks on the
My goal here is to open temp.php, explode by ### (line terminator), then by
I have a page with several links that open a separate window with varying
I want to use response.redirect to open page in new window or tab. I
In one of my apps I want to open a new window/tab for a
I am using the SharpZipLib open source .net library from www.icsharpcode.net My goal is
I'm doing a little experimentation. The end goal is to open Twitter in a
my goal is to open a ContextMenuStrip on right click remember this click x
Here's the code from sys import argv script,from_file, to_file = argv open(to_file,'w').write(open(from_file).read()) I'm new
My goal is to submit a form in a Colorbox modal via ajax (that

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.