[lug] newgrp and aliases

Jeffrey S. Haemer jeffrey.haemer at gmail.com
Wed Jan 16 14:34:28 MST 2013


Davide,

Are you getting the infinite loop in (3) because "newgrp -" spawns a login
shell, which re-reads your .bash_profile, which executes "newgrp -", which
... ?

If so, just don't newgrp once you're in the right group. Put this at the
end of the .bash_login file instead:

current_group=$(id -g)
if [ $current_group -ne *<numeric id of desired group>* ]; then
  newgrp - *<name of desired group>*
fi

-- 
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell], http://seejeffrun.blogspot.com [blog],
http://www.youtube.com/user/goyishekop [vlog]
*פרייהייט? דאס איז יאַנג דינען וואָרט.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20130116/53db9dac/attachment.html>


More information about the LUG mailing list