Can please someone explain, why this is not working??
#!/bin/bash
cmd="ps aux | grep -v grep"
cnt=$($cmd)
I get an error from ps.
error: garbage option
Usage:
ps [options]
.....
"ps aux" only will be ok - but not with any additional piped commands.
Thanks!