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

221 views Asked by At

What does that line mean?

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

It is a part of a Bash script.

1

There are 1 answers

4
Maroun On BEST ANSWER

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)