kaustubhghanekar.blogspot.in - Kaustubh Ghanekar

Example domain paragraphs

Sharing all my experiences, collective information all here, home, work and party!

Here is a small command to find number of users in particular group on a *nix system. An example for wheel group: grep wheel /etc/group | fgrep -o , | wc -m Now here's a catch, this command actually counts the commas in the line from the group file. So if there are 5 users in the group, the output will be 4. You will have to add a 1 to the output. So when using it in scripts, one can use it like this: VAR1=$(($(grep wheel /etc/group | fgrep -o , | wc -m) + 1)) echo $VAR1 5 Explanation: First grep will print

posted by KG @ December 07, 2015   0 Comments

Links to kaustubhghanekar.blogspot.in (1)