原因:
1./bin/bash 和 /bin/sh
查看当前登陆shell
cat /etc/passwd|grep [username]或者
echo $SHELL
That probably means that the new user account was created with /bin/sh as its login shell (which symlinks to the dash shell by default) instead of /bin/bash - you can change a user's login shell with the 'chsh' command
sudo chsh -s /bin/bash <username>(you will need to log out and back in for the change to take effect). You may also need to copy the default .bashrc from /etc/skel to get the color prompt.
2. adduser 和useradd
In future you might want to use the 'adduser' command instead of 'useradd' - it sets up a more complete user environment including things like a default .profile and .bashrc - as well as setting the login shell to 'bash'
3. 这个问题可能是ubuntu特有的
在一个Debian系统的sh并没有出现上面的问题
4.profile 和 bashrc
profile中的配置 要用户登陆 才会加载,profile中有运行bashrc的语句
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
bashrc中的配置 ,非交互的bash 会加载,我猜sh一类的命令也会加载这个文件,运行脚本文件也会加载其中的配置
所以如果在terminal中输入bash 打开另一个bash,则bashrc 会加载两次,即:
如果bashrc 中有PATH=$PATH:XXX这类语句,则在检讨打开的bash中,echo $PATH的结果为
.......:XXX:XXX
http://www.cnblogs.com/hongzg1982/articles/2101792.html
http://blog.chinaunix.net/uid-589727-id-2732667.html
参考:
1.http://askubuntu.com/questions/325807/arrow-keys-tab-complete-not-working
在Linux环境中,遇到终端箭头键不可用和Tab无法补全命令的问题,可能与用户登录Shell设置有关。问题可能源于/bin/bash与/bin/sh的差异,或者在使用adduser和useradd命令时未正确配置。此外,.profile和.bashrc的配置也可能影响终端行为。解决方法包括检查并修改用户登录Shell,以及调整配置文件内容,确保.bashrc正确加载。
926

被折叠的 条评论
为什么被折叠?



