simple script... take users from a group and add in another group
hello all
im very bad at making scripts, all i need to do is take all users from a ldap group, and add in a local group, but im not sure how to make it getent group |awk -F':' '/groupA/{print $4}' user1,user2,user3,user4,user5 now i need to add it all to groupB |
Code:
getent group |awk -F':' '/groupA/{print $4}' Code:
getent group |awk -F':' '/groupA/{print $4}' > /tmp/userlist-groupA |
hello
thx for the reply, this almost work, just one thing need to be fixed getent group |awk -F':' '/groupA/{print $4}' > /tmp/userlist-groupA the users are listed in the file as user1,user2.user3,etc how can i list them like this user1 user2 user3 etc? |
Ah that is really irritating stuff. I have come up with a work around but don't know that is the most efficient way to do it or not. Here you go:
Code:
for i in {1..100} Hope it works for you. |
thanks a lot for the help!
i figured out another solution for it as well, i tested and it worked :) Code:
#/bin/bash |
Could pipe to while read to avoid temp files:
Code:
#!/bin/bash |
Nice!! You're welcome. Please mark the thread as solved.
|
All times are GMT -5. The time now is 08:03 AM. |