First of all, please use ***
[code][/code] tags*** around your code and data, to preserve formatting and to improve readability. Please do
not use quote tags, bolding, colors, or other fancy formatting.
Next, what output do you get? What are the error messages, if any?
Also, what exactly does the
who command output for you? I don't have a multi-user system, so I can't run any tests without it. The same goes for
whoami, (not "who am i" !). But in any case you can probably substitute the built-in
$USER variable instead.
In short, it usually helps when we can see the same things you do.
Don't forget to quote your substitutions, unless you want the output to be word-split afterwards, just like when using variables.
What do you think the "
{..}" brackets are supposed to be doing here? In this configuration they would be treated as part of the
grep expression. If they were moved inside the "
$(..)" then they could be considered a command grouping; but only if the final "
}" keyword is separated from the last command with a semi-colon. i.e.
Code:
{ command1 ; command2 ;}
This syntax is necessary when the grouping is all on a single line.
But since the command substitution already acts as a grouping pattern, they wouldn't be necessary anyway.
Finally, the initial
echo and substitution brackets are completely pointless. The chain itself will print to stdout.
Assuming the commands themselves are correct, try this:
Code:
who | cut -b10-20 | grep -v "$( whoami | cut -b10-20 )"
who | cut -b10-20 | grep -v "$USER"
There are probably better ways to do this, however.