How do I make an environment variable refresh in bash profile? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How do I make an environment variable refresh in bash profile?

When I try to configure the shell prompt as below, export PS1="${PWD}> " the path doesn't update after navigating to other directories. Why is that?

28th Nov 2019, 3:18 PM
Moses Odhiambo
Moses Odhiambo - avatar
1 Respuesta
+ 2
Because you basically set PS1 to a string value that doesn't get updated. However there are a lot of escape sequences that help you to customize your prompt: https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html P.S. replacing ${PWD} with \w might be all you need to do.
29th Nov 2019, 11:06 AM
Aaron Eberhardt
Aaron Eberhardt - avatar