Here is a part of my .bashrc file:
echo_pwd () {
echo `pwd`
}
export echo_pwd="`echo_pwd`/"
I created a new function echo_pwd that prints the path of the current directory and a new environment variable that contains the current directory followed by a slash. Therefore, I can use my environment variable in command line (such as $PWD).
However, this environment variable doesn't expand correctly and always refers to my home directory:
~/Documents$ env | grep echo_pwd
echo_pwd=/home/pierre/
~/Documents$
What can I do to make my environment variable expands correctly?
Note: this is obviously a dummy example. In my specific use case, the echo_pwd is a much more complex function.