Solved Unable to run aliases with /bin/sh

I'm trying to add an alias to the current shell, but it doesn't work. I'm used to Bash with Linux so I'd like to use Bourne shell (sh) with FreeBSD, at least for now.

Here's the config:

Code:
$ getent passwd bogdan
bogdan:*:1001:1001:Bogdan:/home/bogdan:/bin/sh

$ echo $SHELL
/bin/sh

$ cat ~/.shrc | grep abc
alias abc='echo Test'

$ abc
abc: not found

$ bash    #which is found in /usr/local/bin/bash
[bogdan@lion ~]$ echo $SHELL
/bin/sh

[bogdan@hostname ~]$ abc
bash: abc: command not found

[bogdan@hostname ~]$ source ~/.shrc

bogdan@hostname$ echo $SHELL
/bin/sh

bogdan@hostname$ abc
Test

So I have to type bash and then source the config file to get the alias working.

I updated the default shell to bash with chsh -s /usr/local/bin/bash bogdan and now the shell is recognized as bash, yet the alias doesn't run until I source the ~/.shrc file:

Code:
[bogdan@hostname ~]$ echo $SHELL
/usr/local/bin/bash
[bogdan@hostname ~]$ abc
bash: abc: command not found
[bogdan@hostname ~]$ source ~/.shrc
bogdan@hostname$ abc
Test

Is there any way to fix this?
 
Found the fix:

cp ~/.shrc ~/.bashrc

Now the default shell is bash and the alias is working:

Code:
bogdan@hostname$ echo $SHELL
/usr/local/bin/bash
bogdan@hostname$ abc
Test

Hope this will help others too.
 
For some reason, it doesn't work here. I'll keep this in mind to make some tests later. Thank you.
 
Back
Top