1834813 Members
2638 Online
110070 Solutions
New Discussion

dot(.)profile

 
yonjon
Occasional Contributor

dot(.)profile

I am trying to change my group id within .profile and execute an application as new group id.

newgrp does not work.

once i do newgrp within the .profile, i can not execute anything after that line.

Thanks.

5 REPLIES 5
Rodney Hills
Honored Contributor

Re: dot(.)profile

In your script, try

newgrp yourgroup <-EOF
command1
command2
EOF

HTH

-- Rod Hills
There be dragons...
yonjon
Occasional Contributor

Re: dot(.)profile

thanks for the quick answer. this is what i did. But I do not get the command line. Usually after it run the .profile, i should get to command line, but it is hanging. wonder why....

newgrp mygroup<<_EOF
if my_c_program
start_application
else
echo "Error"
fi
_EOF
Bill Hassell
Honored Contributor

Re: dot(.)profile

newgrp is almost useless. It will never work in a script because it always replace the current shell with a new shell. Rather than use this useless command, just add your name to the /etc/group file then check your membership with the command: id

You'll now be a member of multiple groups. (this assumes you are using supported versions of HP-UX. If not (ie, 10.20 or earlier) then you'll have to create a symlink: ln /etc/group /etc/logingroup)


Bill Hassell, sysadmin
yonjon
Occasional Contributor

Re: dot(.)profile

i am not sure what u r suggesting here. could you please elaborate more or give me and example.
Kent Ostby
Honored Contributor

Re: dot(.)profile

In the /etc/group file add another line:

myothergroup:username

Now you are a member of that group and can execute commands with that group permission.

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"