Skip to main content
added 229 characters in body
Source Link
Stéphane Chazelas
  • 585.4k
  • 96
  • 1.1k
  • 1.7k

One possible explanation is that you do

alias done='something'

prior to sourcing /usr/share/bash-completion/bash_completion.

That would explain that error message as bash would complain about the function being closed while the while loop hasn't (because of the missing done that was replaced by something).

Don't use done or any shell keyword as an alias name (though you could define some instrumenting aliases like alias do='do ((loop_level++));'; alias done='((loop_level--)); done' as long as they keep the shell structure).

One possible explanation is that you do

alias done='something'

prior to sourcing /usr/share/bash-completion/bash_completion.

That would explain that error message as bash would complain about the function being closed while the while loop hasn't.

Don't use done or any shell keyword as an alias name.

One possible explanation is that you do

alias done='something'

prior to sourcing /usr/share/bash-completion/bash_completion.

That would explain that error message as bash would complain about the function being closed while the while loop hasn't (because of the missing done that was replaced by something).

Don't use done or any shell keyword as an alias name (though you could define some instrumenting aliases like alias do='do ((loop_level++));'; alias done='((loop_level--)); done' as long as they keep the shell structure).

Source Link
Stéphane Chazelas
  • 585.4k
  • 96
  • 1.1k
  • 1.7k

One possible explanation is that you do

alias done='something'

prior to sourcing /usr/share/bash-completion/bash_completion.

That would explain that error message as bash would complain about the function being closed while the while loop hasn't.

Don't use done or any shell keyword as an alias name.