sjantke
sjantke

Reputation: 595

Bash Scripting ^-...------ | wc …

What does that line mean?

^-...------ | wc ...

It is a part of a Bash script.

Upvotes: 2

Views: 219

Answers (1)

Maroun
Maroun

Reputation: 96018

Try to write:

ls -l | grep ^.......... | wc -l

the output of ls -l will be piped, and this will return the number of all files, because . matches any character.

In your case, someone wanted to count number of files that only (might) have owner permission, that's why the pattern doesn't care about first three flags.

Look for example at this line:

-rw-------  1 root   root    35 Jun 15 15:32 .smbpasswd
↑↑↑↑↑↑↑↑↑↑

Not that the line ^-...------ | wc ... by itself is invalid.

(Thought about that after I read @GordonDavisson comment, thanks)

Upvotes: 6

Related Questions