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

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is the same.

On machine 1 I run bash scripts within a terminal window with the simple: ./

On machine 2, I cannot do this and must use: sh Nor can I use ./ and tab-complete the script filename.

All executable bits are set correctly, all files and folders have the correct permissions. In the header of the scripts the shebang is set correctly.

Any ideas why this would be occurring?


share|improve this question
also asked on unix&linux and stackoverflow – glenn jackman Nov 5 '12 at 1:50
Is this for root, or a non-root user? Does echo $SHELL on both machines confirm that the shell is bash? – Lars Rohrbach Nov 5 '12 at 1:56
non-root user, echo $SHELL returns /bin/bash on both machines – adeliefan Nov 5 '12 at 2:01

The only thing that would cause this is if the script is not executable. I know you said the executable bit is set, but make sure:

chmod +x
share|improve this answer
Nope - its definitely set right. I figure there has to be something wrong with my environmental set up (.bashrc or .bash_profile) but cant see where it has snuck in. – adeliefan Nov 5 '12 at 2:08

I've read of various problems arising with auto-completion, not necessarily with 12.04, and the following two options seem worth trying:

First, try disabling bash programmable completion: Comment-out these three lines in both /etc/bash.bashrc and in the user's $HOME/.bashrc:

 if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
     . /etc/bash_completion

You may find that those lines are already commented-out with # in front, in which case just leave it as-is.

So secondly, try re-installing bash-completion:

sudo apt-get purge bash-completion
sudo mv /etc/bash_completion.d /etc/bash_completion.d.bak
sudo apt-get install bash-completion
share|improve this answer
Thanks for the suggestion Lars, it made no difference though. – adeliefan Nov 5 '12 at 2:18
Well, darn. I presume you re-logged-in after doing this? – Lars Rohrbach Nov 5 '12 at 2:27

The errors you see may be caused by trying to run an executable on a media mounted with the "noexe" property. Type mount, and examine the properties of the device which contains the script. Change the /etc/fstab properties of the mount if necessary.

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.