xargs expr ...+

I would like to use expr on stdin, but I know it doesn't work. I have seen this syntax:

ls -l|wc -l | xargs expr -3 +

and it seems to do what I need, but could someone explain what the final + is for and why it doesn't work if I run:

ls -l|wc -l | xargs expr +3 +

Thanks in advance!

try..
+ means add -3 to the wc -l o/p however when you wanna add +3 please mention 3 and not +3

 ls -l|wc -l | xargs expr 3 +

Great! Now I understand it, I'm much happier using this syntax.

Thanks for your quick reply

When a pipeline's output is just a single value, there's usually no need or benefit in using xargs. A simple command substitution will do.

I said "usually" above because xargs treats quotes specially and that could be useful in some scenarios (though not this one, which only produces numeric strings).

expr $(ls -l | wc -l) - 3

Why you're using ls' long format just to count lines is puzzling, but not germane to my point.

Regards,
Alister