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.

I restarted my kubuntu machine - from the menu leave->restart if that matters. Normally my terminal windows are brought up automatically after a reboot but this time my prompt was wrong and a bunch of other bizarre things.

Now /bin/sh is a link to /bin/dash and dash seems to have been loaded but suddenly it is a lot dumber than it was before the reboot. Now it doesn't recognize what shopt is. When I try to dot execute my profile (. ~/.bash_profile) I get error like /bin/sh: 28: /etc/bash_completion: [[: not found. On the command line command completion does not work nor the up & down keys for command history.

I have not knowingly downloaded any packages that should have messed with this. Is there a valid reason why this should suddenly start happening.

Now I executed /bin/bash from the command lines of my terminals and all seems to be well but this does not explain what is wrong with dash. Also bash is allegedly heavier than dash and since I open 20 or so terminals I would like to avoid that overhead if it is true.

Thank you for any insights into this.

share|improve this question
    
[[ is and has always been bash only. It's an internal command (unlike [, which is a binary). –  Dennis Dec 28 '12 at 3:19
    
Dash is a lighter version of bash so I assume the same applies. There has been no changes to my system to account for the above - at least of which I am aware. –  Newton Falls Dec 28 '12 at 3:21
    
[[ works in bash and ksh, but not in dash. I've tested it on my system to verify. This presentation agrees. I'm not sure what changed on your system, but [[ cannot work with dash. The rest of your problems should be due to the fact that .bash_profile can't be sourced. –  Dennis Dec 28 '12 at 3:27
    
Thank you. I don't know what happened. I may just change the /bin/sh link to point to bash and be done with it. –  Newton Falls Dec 28 '12 at 3:39
    
My best guess is that this is what happened in the first place. Changing /etc/passwd is more stable and prevents non-interactive shells from using Bash by default (it is heavier, after all). –  Dennis Dec 28 '12 at 3:42
add comment

1 Answer

up vote 1 down vote accepted

You can't have been using dash all this time:

  • Dash cannot understand [[, since it's one of Bash's internal commands.

  • Dash does not support tab completion.

  • Dash does not support arrow keys (editing, history).

(Source)

The only possible explanation is that your default shell changed somehow. I obviously can't know how this happened, but I can only think of two ways:

  • Something edited /etc/passwd and replaced your default shell. That's highly unlikely.

  • You were accessing Bash through a symlink (most likely /bin/sh), and a recent update set the symlink to its default target.

While it is true that Bash is heavier than Dash, this shouldn't be a problem with terminals (what Bash is designed for).

However, non-interactive shells should still use Dash by default (which is why /bin/sh should point to Dash).

share|improve this answer
add comment

Your Answer

 
discard

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.