Run script on shell login for all users
You could save your script in /etc/profile.d/als.sh
. According to Ubuntu EnvironmentVariables manual:
Files with the .sh extension in the /etc/profile.d directory get executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads.
You should also modify relative path with absolute path:
cat /home/$USER/.bashrc | egrep 'alias.+\=' | tr -s [:space:] | sed 's_^ alias_alias_' | sed 's_alias__' | sort | sed 's_=_\t\t_' | sed 's_^ __'
And this should works for all users.