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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:18:56+00:00 2026-06-18T11:18:56+00:00

I am porting a sh script that was apparently written using GNU implementation of

  • 0

I am porting a sh script that was apparently written using GNU implementation of sed to BSD implementation of sed. The exact line in the script with the original comment are:

# escape dot in file extension to grep it
ext="$(echo $ext | sed 's/\./\\./' -)"

I am able to reproduce a results with the following (obviously I am not exhausting all possibilities values for ext) :

ext=.h; ext="$(echo $ext | sed 's/\./\\./' -)"; echo [$ext]

Using GNU’s implementation of sed the following is returned:

[\.h]

Using BSD’s implementation of sed the following is returned:

sed: -: No such file or directory
[]

Executing ext=.h; ext="$(echo $ext | sed 's/\./\\./')"; echo [$ext] returns [\.h] for both implementation of sed.

I have looked at both GNU and BSD’s sed‘s man page have not found anything about the trailing “-“. Googling for sed with a “-” is not very fruitful either.

Is the “-” a typo?
Is the “-” needed for some an unexpected value of $ext?
Is the issue not with sed, but rather with sh?

Can someone direct me to what I should be looking at, or even better, explain what the purpose of the “-” is?

  • 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-06-18T11:18:57+00:00Added an answer on June 18, 2026 at 11:18 am

    On my system, that syntax isn’t documented in the man page, but it is in the
    ‘info’ page:

    sed OPTIONS… [SCRIPT] [INPUTFILE…]

    If you do not specify INPUTFILE, or if INPUTFILE is -',sed’
    filters the contents of the standard input.

    Given that particular usage, I think you could leave off the ‘-‘ and it should
    still work.

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

Sidebar

Related Questions

I am responsible for a Windows application that loads up plugin script dll's written
I am converting a script to use Gtk3 using the migration guide ( Porting
I have a VBA Macro script that scrapes some data. It's scrapes it using
I'm working on porting bash script to SUS/POSIX-compliant shells. I was able to remove
I'm in the process of porting over a script from HP-UX to LINUX. When
I'm porting an existing app to rails that makes extensive use of stylized anchors
I'm porting a small Qt application to the Android . I am using Qt
I've got a web app that I'm porting to an OS X Dashboard widget.
I'm sorry to be posting about another problem with the same script that I
I'm working on porting some PHP code to C, that contacts a web API.

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.