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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:52:30+00:00 2026-05-28T20:52:30+00:00

I’m using msysgit on Windows and wrote a simple shell script that I would

  • 0

I’m using msysgit on Windows and wrote a simple shell script that I would like to use. I added the folder that the .sh file is in to the PATH variable of my Windows computer but when I want to use my script I have to type rd.sh instead of just plain rd.

How do I use this by just referring to its name rd and not the full file name with the .sh file extension (rd.sh)?

  • 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-28T20:52:31+00:00Added an answer on May 28, 2026 at 8:52 pm

    The shell provided with msysgit is bash, which runs in an emulated Unix-like environment.

    If you’re running the script from the bash shell, you need to type the name of the script, which as far as the Unix-like environment is concerned is rd.sh. The .sh has no particular meaning in a Unix environment; it’s just the last three characters of the file name. The first line of the script should be #!/bin/sh or #!/bin/bash; this is known as a “shebang”.

    On the other hand, if you want to run it from Windows (say, from a cmd.exe command prompt), then the .sh extension is used by Windows to determine how to execute it, and you can invoke it as rd if (a) it’s in a directory in your %PATH%, and (b) Windows is configured (in Folder Options and/or by setting %PATHEXT%) to use sh or bash to launch .sh files.

    If you want to be able to run the same script from either environment, you can create a symbolic link that will be recognized in the emulated Unix-like environment. For example, if rd.sh is in $HOME/bin, then this:

    ln -s $HOME/bin/rd.sh $HOME/bin/rd
    

    will create the appropriate symlink. (You could make rd a copy of rd.sh, but then changes to one won’t apply to the other.)

    If you only need to run it from bash, just call it rd rather than rd.sh; as I mentioned, as far as bash is concerned the .sh extension is just part of the name and has no particular significance. It’s the #! line, not the .sh extension, that tells bash how to execute the script.

    (Well, strictly speaking it’s not bash that handles the #!. On actual Unix or Linux systems, it’s handled by the kernel; I’m not sure what the exact mechanism is under msysgit.)

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.