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 MellorChartered AccountantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use bash - read Equivalent of .bat in mac os

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.