Solved

Batch File Equivalent in OS X Terminal?

Posted on 2013-12-31
3
1,390 Views
Last Modified: 2014-02-03
What's the equivalent to a MS DOX Batch file in the OS X Terminal? What's the file extension to a batch file equivalent?
0
Comment
Question by:jdana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Accepted Solution

by:
lruiz52 earned 280 total points
ID: 39749428
The equivalent to a dos batch file would be a shell script with a .sh extension.

You would have to make the file executable by running;

chmod 755 scriptname.sh

Then running it like this;

bash scriptname.sh
0
 
LVL 29

Expert Comment

by:serialband
ID: 39752590
If you want to make it clickable in the finder, it should be renamed with the .command extension.

While you can run bash scriptname.sh on a bash script file, you generally want to make the first line of the bash file  #!/bin/bash so that you can run it from the local path as ./scriptname.sh.  If you put the script in your defined path, you can just run it as scriptname.sh  The .sh isn't even necessary except for you to easily spot them when you list the files.  The chmod 755 command is actually what makes it executable in linux/unix.  If you don't run the chmod command, then you do need to call bash scriptname.sh.
0
 

Author Closing Comment

by:jdana
ID: 39831068
Cool stuff. Thanks guys!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Even though Mac OS X has been around for many years now, certain well-liked and eminently useful software apps never made the jump from Mac OS 9 to Mac OS X. Ever used Word Perfect for Mac? Version 3.5 was the last version, built for Mac OS 9. Who c…
A professional opinion on which Apple product to buy, and a tidbit about the WWDC.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question