Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • Thanks for the answer. Sure, I always forgot to escape my var... Sry. su - root -c "[[ -v HOME ]]" && echo ok || echo no Doesn't work $ su - root -c "[[ -v HOME ]]" && echo ok || echo no -sh: -c: line 0: conditional binary operator expected -sh: -c: line 0: syntax error near HOME' -sh: -c: line 0: [[ -v HOME ]]' For su - root -c 'echo $HOME | ...' I took the habit to escape the var like that su - root -c "echo \$HOME | ..." I don't know which one is the best practice. And omg I didn't think about wc -w ! It does what I wanted to ! Thx Commented Oct 28, 2016 at 13:05