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

The Archive Base Latest Questions

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

I am trying to run a script remotely (from a bash script), but am

  • 0

I am trying to run a script remotely (from a bash script), but am having trouble getting the output to redirect locally, for analysis. Running the script is no problem with:

ssh -n -l "$user" "$host" '/home/user/script.sh $params'

However I am unable to capture the output of that script. I have tried the following:

results=$(ssh -n -l "$user" "$host" '/home/user/script.sh $params')
results=`ssh -n -l "$user" "$host" '/home/user/script.sh $params'`
ssh -n -l "$user" "$host" '/home/user/script.sh $params' | grep "what I'm looking for"
ssh -n -l "$user" "$host" '/home/user/script.sh $params' > results_file

Any ideas?

  • 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-28T16:57:48+00:00Added an answer on May 28, 2026 at 4:57 pm
    ssh user@host.com "ls -l" >output
    

    You can even do things like:

    ssh user@host.com "cat foo.tar" | tar xvf --
    

    To make things simple, generate a pub/private key pair using ssh-keygen.
    Copy the *.pub key to the remote host into ~/.ssh/authorized_keys, make sure
    it’s chmod’d 600

    Then you can do

    ssh -i ~/.ssh/yourkey user@host.com … etc

    And it won’t ask for a password either. (If your key pair is passwordless)..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to Run Shell script in Cygwin but I am getting Following
I'm trying to run a script from the commandline, and python is having absolutely
I'm trying to run a script from the Windows XP console. (In case it's
I'm trying to run a bash script that has: ssh -l <username> <compname> 'sudo
I get the following error from the SQL Script I am trying to run:
I'm trying to run a script, which internally invokes other script but, the main
I,m trying to run one php script in background. But its no working... I
I am trying to run the script csv2json.py in the Command Prompt, but I
I am trying to run a script from within a script and have the
I am trying to run a script with nohup, but the command happens to

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.