DavidYan

autocomplete sh: <( compgen -d — ” ): No such file or directory

http://www.dansketcher.com/2010/01/15/autocomplete-sh-compgen-d-no-such-file-or-directory/

Not much of a title, I know, but something for fellow stumped google-wanderers..

I’ve been playing around with deprec for automatically provisioning new servers for my Rails applications. However, I hit a strange problem where certain command-line auto-completions did not work; I’d get an error message like this:

$ ls
temp

$ cd [hit tab to get autocomplete]
-sh: <( compgen -d -- \'\' ): No such file or directory
-sh: <( compgen -f -X -- \'\' ): No such file or directory

The confusing thing was that only the unpriviliged user exhibited this behaviour, not the root user.

I tried reinstalling the bash-completion package to no avail (even an aptitude purge then aptitude install did not work). Eventually I came across this rather long post on bugs.debian.org where someone else has the same problem. Essentially it comes down to the unpriviliged user using /bin/sh as the default shell; under these circumstances autocompletion is supposed to not function (although presumably without error). This is despite /bin/sh being a symlink to /bin/bash

The fix, then, is actually quite simple. Change the default shell for all your unprivileged users to bash:

# usermod -s /bin/bash dansketcher

and then when you make new users, make sure you select bash explicitly:

# useradd newuser -m -s /bin/bash

上面已经说了解决方案,简单说就是:

如果用户已经创建的话,执行以下命令:

# usermod -s /bin/bash dansketcher

如果用户未创建,执行以下命令:

# useradd newuser -m -s /bin/bash

注: 转载自 http://hi.baidu.com/oscarbj/blog/item/d6319bef5e72543badafd541.html

分类:

技术点:

相关文章:

  • 2021-11-11
  • 2021-05-06
  • 2021-08-20
  • 2021-12-23
  • 2021-09-27
  • 2021-11-16
  • 2021-08-19
  • 2021-08-14
猜你喜欢
  • 2022-01-13
  • 2021-09-23
  • 2022-01-13
  • 2021-10-26
  • 2021-06-30
  • 2021-06-26
相关资源
相似解决方案