I do not understand -printf script

Posted by jerzdevs on Super User See other posts from Super User or by jerzdevs
Published on 2013-11-12T21:36:12Z Indexed on 2013/11/12 21:57 UTC
Read the original article Hit count: 150

Filed under:
|
|

I have taken over the responsibility of RHLE5 scripting and I've not had any training in this platform or BASH scripting. There's a script that has multiple pieces to it and I will ask only about the second piece but also show you the first, I think it will help with my question below.

The first part of the script shows the output of users on a particular server: cut -d : -f 1 /etc/passwd

The output will look something like: root bin joe rob other...

The second script requires me to fill in each of the accounts listed from the above script and run. From what I can gather, and from my search on the man pages and other web searches, it goes out and finds the group owner of a file or directory and obviously sorts and picks out just unique records but not really sure - so that's my question, what does the below script really do? (The funny thing is, is that if I plug in each name from the output above, I'll sometimes receive a "cannot find username blah, blah, blah" message.)

find username -printf %G | sort | uniq

© Super User or respective owner

Related posts about linux

Related posts about bash