you can put it in /etc/profile, which will be sourced for all users (using bourne style shells like bash, ksh, zsh etc). Often /etc/profile has a little loop that sources all /etc/profile.d/*.sh files, if yours has that (or if you add it yourself) it's better to make a new file and put it there. Eg in /etc/profile.d/dirvariable.sh
Then users can do
but I don't see this as being much more convenient than cd'ing directly. Ie.
If this should only be set for specific users you can use an if statement that checks the username.