I am writing a bash script, and on a condition I'd like to output
ps aux --sort -rss
However, when I write :
echo `ps aux --sort -rss`
everything is on one huge line. How do I run it so it outputs like it normally does in a terminal?
Quote the command:
Otherwise bash just parses the tokens, ignoring whitespace including newlines like it does when you type it by hand.
|show 2 more comments|
Get rid of the echo entirely, and just issue the command