man bash:
COMMENTS
In a non-interactive shell, or an interactive shell in which the interactive_comments option to the shopt
builtin is enabled (see SHELL BUILTIN COMMANDS below), a word beginning with # causes that word and all
remaining characters on that line to be ignored. An interactive shell without the interactive_comments
option enabled does not allow comments. The interactive_comments option is on by default in interactive
shells.
создайте файл myvars.sh в /etc/profile.d/ и добавьте его в файл
var="name#12"
export var=$var
после повторного входа
$ echo $var
name#12
для отключения комментариев в интерактивной оболочке:
$ shopt -u interactive_comments