I created a new user by executing
sudo useradd -m harry
When I try to substitute the user by "su - harry" then everything I can see is a "$" (dollar) sign, the autocompletion isn't working and the shell builtins (e.g. source) are not available.
I checked .bashrc and .profile and detected that .bashrc is not getting sourced because $BASH_VERSION is not set.
The code inside .profile looks like follows:
# if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi
echo $BASH_VERSION returns nothing.
$ echo $BASH_VERSION $
Shell builtins (source .bashrc, . .bashrc) don't work either.
The SHELL variable value was '/bin/sh' which is alias of dash. I changed it to /bin/bash (export SHELL=/bin/bash) but it didn't have any effects.
When I hardcode ". .bashrc" in .profile (of course, just to check if it would work) I receive several errors:
admin@host:~$ sudo su - harry -su: 13: /home/harry/.bashrc: shopt: not found -su: 21: /home/harry/.bashrc: shopt: not found -su: 105: /home/harry/.bashrc: shopt: not found -su: 28: /etc/bash_completion: [[: not found -su: 34: /etc/bash_completion: [[: not found -su: 51: /etc/bash_completion: Bad substitution \[\e]0;\u@\h: \w\a\]\u@\h:\w$
Any ideas how to fix it?
Thank you in advance. jepetko