[lug] newgrp and aliases

Davide Del Vento davide.del.vento at gmail.com
Tue Jan 29 09:46:25 MST 2013


Folks,
Just a heads up in case somebody really wants to do this. On my
machine "newgrp -" breaks X forwarding. It must have something to do
with the re-login and losing the DISPLAY environmental variable (so it
should be fixable without too much effort). However the "smart system"
has received an update and now understand what I want, therefore I'm
setting my default group there, which gets propagated to the more
conventional /etc/passwd. I thought, it's good to let the group know
about this glitch.
Cheers,
Davide

On Wed, Jan 16, 2013 at 2:56 PM, Davide Del Vento
<davide.del.vento at gmail.com> wrote:
> Of course I meant:
>
> wanted_group=<string-of-wanted-group>
> my_current_group=`id -g -n`
> if [[ $my_current_group == $wanted_group ]]; then
>   #rest-of my bash_profile so it doesn't get executed twice
> else
>   newgrp - $wanted_group
> fi
>
>
> And this works great :-))))
>
> Any trick to make the exit command exiting twice? Of course alias
> exit='exit;exit' doe not work.
>
> Cheers,
> Davide
>
>
> On Wed, Jan 16, 2013 at 2:50 PM, Davide Del Vento
> <davide.del.vento at gmail.com> wrote:
>> You are so cool, Jeffrey :-)
>>
>> I just made it slightly smarter
>>
>> wanted_group=<string-of-wanted-group>
>> my_current_group=`id -g -n`
>> if [[ $my_current_group != $wanted_group ]]; then
>>   #rest-of my bash_profile so it doesn't get executed twice
>>   newgrp - $wanted_group
>> fi
>



More information about the LUG mailing list