Wednesday, March 27, 2013

Sharing Bash Functions


In order to share a bash function between all logins you can insert the function in /etc/bash.bashrc and source it in /etc/profile.


In order to share a members function that all users can execute to find which users belong to a particular unix user group, then do the following:


   cat /etc/group | grep --regex "^$1:.*" | awk -F: '{print $4}'


# ...
source /etc/bash.bashrc

Now, when any user logs in they will be able to run members like this:

$ members users

Sponsor Ads

No comments:

Post a Comment