Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wrote my own shell script, and I made it executable with "chmod +x" command. But when I click to shell file and want to run it in terminal, it suddenly opens and then closes in a second. What is the problem?

share|improve this question
When scrpits have errors they exit. So unless you list the contents of the script its a guessing game –  Meer Borg Apr 23 '13 at 12:18
no, script hasn't any error. I just want to simply run it in Terminal with clicking to the current file. –  Ziyaddin Sadigov Apr 23 '13 at 13:07

1 Answer 1

up vote 4 down vote accepted

It also closes automatically once it has run your command.
Add /bin/bash at the end of your script to keep the terminal open.

You can also add a && sleep 10 to keep the terminal open 10 seconds and see what's going on.

share|improve this answer

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.