Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run a shell-script say test from vim

echo good morning

Now when I am using :!% I am getting a pop like

shell returned 1
Press ENTER or type command to continue

instead of good morning.

Someone please tell me what am I doing wrong. Do I have to change the path,if so how to do it. Running it from my home folder

share|improve this question
Do you also get a message saying "Permission denied"? – Charo Jun 28 '14 at 13:06
If so, as azzid told you, you will have to make the script executable. – Charo Jun 28 '14 at 13:09
If one of the answers solved your issue please take a minute and click the check mark under the vote count to the left, this will signify to everyone that your issue's been resolved. – terdon Jun 28 '14 at 14:31

Try this instead:


I use bash, so my error codes are different, but the path gets a bit of when you run % directly.

Also, you might need to run :!chmod u+x ./% before to make the script executable.

share|improve this answer
Thanks Sir,it worked – Uchiha Itachi Jun 28 '14 at 13:13

That will only work if the script file's permissions have the executable bit set. You can do this through Vim

:! chmod +x %
:! ./%

Or you could just run it through its interpreter manually:

:! bash %
share|improve this answer
Thanks Sir,it worked – Uchiha Itachi Jun 28 '14 at 13:14

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.