Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I want a series of commands to be run by terminal, instead of writing it in a text file and copying and pasting it in there, could I have terminal run it? If so, what does the extension have to be?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

What you are trying to do is create a shell script with a .sh extension (Windows equivalent is a batch file with a .bat extension). Here is a simple tutorial to get you started, here is a more complex one that contains a "hello world" style introduction to shell scripting.

share|improve this answer
@typoking It won't let me use .sh. I can either use .txt or both. How do I isolate .sh? –  JShoe Apr 7 '11 at 2:31
Why can't you use .sh? You said you can use ".txt or both" but .txt is only one thing... what does "both" signify? Have you already read through and tried the link to the tutorial I posted a link to? –  ubiquibacon Apr 7 '11 at 2:35
Ok sorry, I fixed that by getting BBEditor. I did the chmod +x filename.sh thing, but the file didn't change. I used the actual name btw. It didn't become executable. –  JShoe Apr 7 '11 at 2:37
Sorry again, I figured it out on my own. Thanks! –  JShoe Apr 7 '11 at 2:39
@JShoe don't be afraid to mess around try out some tutorials, you will learn a lot through the pain and suffering of figuring these things out. –  ubiquibacon Apr 7 '11 at 2:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.