Link to home
Start Free TrialLog in
Avatar of Anthony Mellor
Anthony MellorFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.

Anthony

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
ASKER CERTIFIED SOLUTION
Avatar of zvitam
zvitam
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Anthony Mellor

ASKER

Thanks, I should have done this years ago.
Bourne Again SHell
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.