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

The Archive Base Latest Questions

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

I have a sed command that works perfectly if I run it locally on

  • 0

I have a sed command that works perfectly if I run it locally on Ubuntu or our embedded client Arago:

sed -i 's/export PART="$1"/export PART="A"/' flash.sh

This results in exactly what I need on both versions of sed, a line that changes:

export PART="$1"

to

export PART="A"

My problem is, I need to run that same command across a network to the embedded client so I tried this on an Ubuntu server using bash, to an Arago client using sh:

ssh -n -o stricthostkeychecking=no root@10.14.150.113 sed -i 's/PART="$1"/PART="A"/' flash.sh

Which results in a line that contains:

export PART=A"$1"

The substitution command needs to stay inside the single quotes so the double quotes are passed as literals, or maybe there’s a better way to keep the double quotes in the two strings? This looks to me like the $1 is simply being ignored like it’s empty and the "A" is being passed as A and replacing the end of PART=. I’ve tried encapsulating the command in single and double quotes, which both result in the same thing. I’ve also tried escaping the quotes with backslashes, same result. I think this is something with quote expansion with sh that I simply don’t understand. Or possibly something I don’t understand with ssh.

I’ve read through a number of other threads that are similar, but none of them dealt with using ssh to run the command remotely. I’m no longer a novice at sed, but this one has become quite the puzzle for me.

  • 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-26T00:17:58+00:00Added an answer on May 26, 2026 at 12:17 am
    ssh -n -o stricthostkeychecking=no root@10.14.150.113 'sed -i "s/export PART=\"\\\$1\"/export PART=\"A\"/" flash.sh'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sed command that I want to run on a huge, terrible,
Hi I need to run 'sed' command on file1.txt and have it extract all
I have a Ruby script that generates a sed command to replace some PHP
I have am trying to use sed to get some info that is encoded
I have a blacklist.txt file that contains keywords I want to remove using sed.
I have a command (citrix xenserver cli delete snapshot command--if it matters) that I
All, I'm trying to run a sed command to strip out card numbers from
I have a sed(1) script doing many step-by-step transformations (substitutions) of a given input
I have a sed script which will read in a file and, if a
I have trouble using sed. I need to replace some lines in very deprecated

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.