• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 40
  • Last Modified:

What is the OSX equivalent to DOS' .BAT files?

Years ago I used batch files to do practically everything, then I switched to mac and failed miserably to go under the hood.

What is the OSX equivalent to DOS' .BAT files and suggest how to migrate after rather too long?

And if the answer is a long list, which one will be closest in terms of syntax?
(All) I want to be able to do is auto navigate around the place and execute scripts like I used to in the 80s.


man bash and man set are proving interesting. It looks like set contains all plus many others of the dos command set.
and http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html
Anthony Mellor
Anthony Mellor
  • 3
1 Solution
You can use bash - read Equivalent of .bat in mac os
Anthony MellorChartered AccountantAuthor Commented:
Thanks, I should have done this years ago.
Anthony MellorChartered AccountantAuthor Commented:
Bourne Again SHell
Anthony MellorChartered AccountantAuthor Commented:
for future people: the crucial piece of information I have been missing all these years, was that whereas DOS is the only shell in DOS, unix has multiple optional shells, so I never related Bash == DOS , always wondered what it was.

So very obvious when you know.

(apologies for forgetting these can be edited.)
> "What is the OSX equivalent to DOS' .BAT files?"
I see you have part of your answer in the above posts, but as far as I know the most popular extension for bash scripts is ".sh", but in UNIX/Linux the extension doesn't make any difference to how it's run, and it might be the same in OSX.  The first line (known as the "shebang" line) of the script specifies what kind of script it will be interpreted to be, e.g. "#!/bin/bash".
Unfortunately, .sh was traditionally used to signify "Bourne Shell" scripts (a predecessor of "Bourne Again SHell" scripts), so using .sh is somewhat ambiguous, but these days not many people use Borne Shell, so I don't think it will confuse many, and they can always check the 1st line of the script if they want to confirm.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now