Originally Posted by Irina
Hello. Thank you very much. I tried your code. It ctreates and redirect to new directoty but only for the duration of my login. When I exit and come back it does not know this function.
My idea is to store this function in .bashrc file so I can use it every time without retyping it.
.bashrc which I access from user@localhost command line via VI editor contains my function mkdircd ().
It is getting intersting... now when i type mkdircd lala it said bash : mkdircd : command not found. "Find" command shows that I have ./bashrc and ./.bashrc files.
The issue could be the difference between a "login" shell and an an "interactive non-login" shell. More information: http://www.gnu.org/software/bash/man...-Startup-Files
This could be tested by logging in and running ...
... and then try to run the function.
A login bash shell uses /etc/profile and the first of ~/.bash_profile, ~/.bash_login and ~/.profile that exists.
An "interactive non-login" bash shell uses ~/.bashrc.
So, if the function definition is in ~/.bashrc and you login to bash the function is not available.
A common technique to have the same customisation regardless of login or non-login, is to source ~/.bashrc in ~/.bash_profile:
[[ -f ~/.bashrc ]] && source ~/.bashrc
Your ~/bashrc file will not automatically be used by bash so you may like to remove it to avoid confusion.