I have a script named "als" that parses the aliases in a user's .bashrc
file that I'd like to run for any user logging in via SSH.
This should display similar to a Message of the day (MOTD) banner. MOTD banners are static data though.
Here's the code.
#!/bin/bash
echo
echo Your aliases:
echo \(from ~/.bashrc\)
echo
cat .bashrc | egrep 'alias.+\=' | tr -s [:space:] | sed 's_^ alias_alias_' | sed 's_alias__' | sort | sed 's_=_\t\t_' | sed 's_^ __'
It works if I append ./als to my ~/.profile
file, but this only executes for me. Again, I'd like this to run for all users on shell login