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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:57:26+00:00 2026-05-23T16:57:26+00:00

It appears that in this question , the answer was to separate statements with

  • 0

It appears that in this question, the answer was to separate statements with semicolons. However that could become cumbersome if we get into complex scripting with multiple if statements and complex quoted strings. I would think.

I imagine another alternative would be to simply issue multiple SSH commands one after the other, but again that would be cumbersome, plus I’m not set up for public/private key authentication so this would be asking for passwords a bunch of times.

What I’d ideally like is much similar to the interactive shell experience: at one point in the script you ssh into@the_remote_server and it prompts for the password, which you type in (interactively) and then from that point on until your script issues the “exit” command, all commands in the script are interpreted on the remote machine.

Of course this doesn’t work:

ssh user@host.com
  cd some/dir/on/remote/machine
  tar -xzf my_tarball.tgz
  cd some/other/dir/on/remote
  cp -R some_directory somewhere_else
exit

Is there another alternative? I suppose I could take that part right out of my script and stick it into a script on the remote host. Meh. Now I’m maintaining two scripts. Plus I want a little configuration file to hold defaults and other stuff and I don’t want to be maintaining that in two places either.

Is there another solution?

  • 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-23T16:57:26+00:00Added an answer on May 23, 2026 at 4:57 pm

    Use a heredoc.

    ssh user@host.com << EOF
    cd some/dir/on/remote/machine
    tar -xzf my_tarball.tgz
    cd some/other/dir/on/remote
    cp -R some_directory somewhere_else
    EOF
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After doing my research, I could not get an answer for this question: When
Based on some answers to this question it appears that +alloc does some behind-the-scenes
Based on this question it appears that the default template for CheckStyle will allow
In follow up to this question , it appears that some numbers cannot be
UPDATE: See my answer to this question first. This appears to be a bug.
I ask this question because it appears that viewDidLoad gets called before the main
We have this bug that only appears 30% of the time for the Release
This is a really strange problem, that appears to be somewhat intermittent (although it
I know that this type of question has been asked over and over again,
My question is related to the answer found in this post by user Consultuning

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.