Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Output in one number

Hello I have a task to count the number of symbolic links (not regular files nor directories etc.) in directory
/bin having b as the first letter of their names.

>  find /bin -name "b*" -type l  -printf l  > list.txt

But it outputs

1111

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

What should I do to change the output to one number (I mean 4) insted of these four 1?

>Solution :

To count correctly also symbolic links with line breaks:

find /bin -name "b*" -type l -printf "l" | wc -c >list.txt
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading